protected void login_Click(object sender, EventArgs e) { dboperation db = new dboperation(); string s = "select *from login where username='******' and password='******'"; DataTable dt = db.ret(s); if (dt.Rows.Count > 0) { Session["userid"] = dt.Rows[0][0].ToString(); string a = dt.Rows[0][3].ToString(); if (a == "Farmer") { Response.Redirect("farmerhome.aspx"); } else if (a == "AO") { string b = "select KID from AOS where aid=" + dt.Rows[0][0] + ""; DataTable d = db.ret(b); Session["kid"] = d.Rows[0][0].ToString(); Response.Redirect("agrihome.aspx"); } else { Response.Redirect("adminhome.aspx"); } } else { Response.Write("<script>alert('Incorrect password & username...')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["uname"] == null) { Response.Redirect("Default.aspx"); } dboperation h = new dboperation(); DataSet ds = h.dbselect(); showdata.DataSource = ds; showdata.DataMember = "student"; showdata.DataBind(); }
static void Main() { dboperation db = new dboperation(); //MessageBox.Show(Properties.Settings.Default.daysused.ToString()); string filename = Application.StartupPath + "\\GNetBillingSoft.exe"; DateTime createddate = File.GetCreationTime(filename); DateTime todaydate = DateTime.Now; DateTime expirydate = Convert.ToDateTime("2017-03-31"); TimeSpan diff = expirydate - todaydate; int limit = 90; int totaldays = diff.Days; int trial = (limit - totaldays); bool expired = false; //if (totaldays>0 && totaldays <= 7) //{ // MessageBox.Show("Expiry after " + totaldays + " days", "Trial Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); //} //else if (totaldays <= 0) //{ // MessageBox.Show("Trial period expired...", "Trial Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); // expired = true; //} //if (trial ==0) //{ // MessageBox.Show("Trial period expired...","Trial Warning",MessageBoxButtons.OK,MessageBoxIcon.Warning); //} //MessageBox.Show("This is a trial version. This software expire after " + trial + " days", "Trial Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); if (!expired) { Properties.Settings.Default.daysused = Properties.Settings.Default.daysused + 1; Properties.Settings.Default.Save(); // MessageBox.Show(Properties.Settings.Default.daysused.ToString()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new mainmdi()); } }