سلام خدمت تمامی اساتید سایت خوب W3-farsi
من یه فرم لاگین درست کردم و کد نویسی شم مشکلی نداره ولی جدیدا یه سطح دسترسی ادمین و یوزر تعریف کردم حالا میخواستم شما دوستان یه زحمت بکشید کد منو ویرایش کنید و قسمت سطح دسترسی رو هم به ان اضافه کنید از کد زیر برای فرم لاگین استفاده میکنم بقیه زحمت با شما دوستان که کد رو ویرایش کنید؟؟؟
باتشکر
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using courseselection;
using anbar;
using System.Globalization;
namespace AnbarPNUTH
{
public partial class LogIn : Form
{
public static string SetValueForText1 = "";
public static string SetValueForText2 = "";
SqlDataAdapter sda;
DataView objDataView;
public LogIn()
{
SqlConnection objconnection = connectionclass.getconnection();
sda = new SqlDataAdapter("SELECT * FROM Login", objconnection);
InitializeComponent();
}
private void FillDataSetAndView()
{
DataSet objdataset = new DataSet();
sda.Fill(objdataset, "Login");
objDataView = new DataView(objdataset.Tables["Login"]);
}
private void timer1_Click(object sender, EventArgs e)
{
/* timer1.Enabled = true;
System.Globalization.PersianCalendar pcc = new System.Globalization.PersianCalendar();
DateTime tm = new DateTime();
tm = DateTime.Now;
button4.Text = pcc.GetHour(tm).ToString() + ":" + pcc.GetMinute(tm).ToString() + ":" + pcc.GetSecond(tm).ToString();
System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar();
DateTime dt = new DateTime();
dt = DateTime.Now;
Class_date cdate = new Class_date();
string date = dt.Year.ToString() + "/" + dt.Month.ToString() + "/" + dt.Day.ToString();
button3.Text = cdate.Shamsi(date);
label4.Text = DateTime.Now.ToLongTimeString();
label3.Text = DateTime.Now.ToLongDateString();*/
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox2.Text == "" || comboBox1.Text=="")
button1.Enabled = false;
if (textBox1.Text != "" && textBox2.Text != "" && comboBox1.Text != "")
button1.Enabled = true;
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
if (textBox2.Text == "")
button1.Enabled = false;
if (textBox2.Text != "")
button1.Enabled = true;
}
private void button1_Click(object sender, EventArgs e)
{
SetValueForText1 = textBox1.Text;
SetValueForText2 = comboBox1.Text;
if (textBox1.Text == "" && textBox2.Text == "" && comboBox1.Text == "")
MessageBox.Show(". لطفا فیلدها را پر کنید");
int intfind1, intfind2, intfind3;
textBox2.Text.Trim();
comboBox1.Text.Trim();
FillDataSetAndView();
objDataView.Sort = "ID";
intfind1 = objDataView.Find(textBox1.Text);
objDataView.Sort = "Pass";
intfind2 = objDataView.Find(textBox2.Text);
objDataView.Sort = "Dastresi";
intfind3 = objDataView.Find(comboBox1.Text);
if (intfind1 == -1 || intfind2 == -1 || intfind3 == -1)
{
textBox1.Text = "";
textBox2.Text = "";
comboBox1.Text = "";
MessageBox.Show("!نام کاربری درلیست موجود نیست", "نتیجه ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox1.Focus();
}
else if ((intfind1 != -1) && (intfind2 != -1) && (intfind3 != -1))
{
this.Close();
}
}
private void LogIn_Load(object sender, EventArgs e)
{
button1.Enabled = false;
/* timer1.Enabled = true;
System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar();
DateTime dt = new DateTime();
dt = DateTime.Now;
Class_date cdate = new Class_date();
string date = dt.Year.ToString() + "/" + dt.Month.ToString() + "/" + dt.Day.ToString();
button3.Text = cdate.Shamsi(date);*/
/* timer1_Click(sender, e);
Loading objLogIn = new Loading();
objLogIn.ShowDialog(this);*/
}
private void LogIn_Load_1(object sender, EventArgs e)
{
button1.Enabled = false;
}
private void comboBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
SendKeys.Send("{tab}");
}
}
}
}