private void productIdToolStripMenuItem_Click(object sender, EventArgs e) { frmLICForm newMDIChild = new frmLICForm(); newMDIChild.MdiParent = this; newMDIChild.Show(); }
private void btlogin_Click(object sender, EventArgs e) { try { string[] lines = null; try { string licpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\app.lic"; lines = File.ReadAllLines(licpath); } catch (Exception ex) { MessageBox.Show("LIC File Missing. Contact Admin."); } string sysid = getSystemId(); string encry = CryptorEngine.Encrypt(sysid, true); string ssysdate = CryptorEngine.Encrypt(DateTime.Now.ToString("dd/MM/yyyy"), true); DateTime sysdate = DateTime.Now; DateTime fromdate = Convert.ToDateTime(CryptorEngine.Decrypt(lines[22], true)); DateTime todate = Convert.ToDateTime(CryptorEngine.Decrypt(lines[45], true)); bool isExpried = false; if (sysdate >= fromdate && sysdate <= todate) { isExpried = false; } else { isExpried = true; } if (encry.Equals(lines[15]) && !isExpried) // if ( !isExpried) //if ( !isExpried) { string connstring = System.Configuration.ConfigurationManager.ConnectionStrings["BUS"].ConnectionString.ToString(); SqlConnection conn = new SqlConnection(connstring); conn.Open(); string qry = "select * FROM LoginMaster Where UserName='******'"; SqlDataAdapter da = new SqlDataAdapter(qry, conn); DataSet ds = new DataSet(); da.Fill(ds); conn.Close(); int rowcount = ds.Tables[0].Rows.Count; if (rowcount == 1) { string comparepass = Convert.ToString(ds.Tables[0].Rows[0]["Password"]).Trim(); string UserRole = Convert.ToString(ds.Tables[0].Rows[0]["UserRole"]).Trim(); if (comparepass == tbpassword.Text) { if (UserRole == "client") { General.Is_Edit = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["IS_EDIT"]); General.Is_Delete = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["IS_DELETE"]); } this.Hide(); MainForm mf = new MainForm(); mf.Show(); } else { MessageBox.Show("Invalid Password"); } } else { MessageBox.Show("Invalid UserName"); } } else { frmLICForm frm = new frmLICForm(); frm.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }