private void metroButton3_Click(object sender, EventArgs e) { SignInEmp ae = new SignInEmp(); EmpInfoLinqDataContext cntx = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str = from a in cntx.taxAndSals where a.Id2 == ae.id2 select a; taxAndSal p = str.First(); p.Count = 1; p.PendingTax = (Convert.ToInt32(metroLabel2.Text) * 2) / 100; cntx.SubmitChanges(); SaveS ss = new SaveS(); ss.CO = Convert.ToInt32(p.Count); AddEmp2 ae2 = new AddEmp2(); ae2.FSA(); if (metroTextBox2.Text == "") { metroTextBox2.Text = "0"; } SaveS sa = new SaveS(); int k = Convert.ToInt32(metroLabel7.Text); if (k == 0) { metroTextBox1.Text = "0"; metroTextBox1.Enabled = false; MetroFramework.MetroMessageBox.Show(this, "Checking Successful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (metroTextBox1.Text == "") { if (Convert.ToInt32(metroLabel7.Text) <= sa.PA) { metroTextBox1.Text = metroLabel7.Text; sa.TL = 0; sa.PA = 0; sa.LA = 0; MetroFramework.MetroMessageBox.Show(this, "Checking Successful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { metroTextBox1.Text = Convert.ToString(sa.PA); sa.LA = sa.LA - sa.PA; MetroFramework.MetroMessageBox.Show(this, "Checking Successful", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (Convert.ToInt32(metroTextBox1.Text) > (sa.PA + 100)) { MetroFramework.MetroMessageBox.Show(this, "Cant Pay That Much Together", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } metroButton3.Enabled = false; metroButton1.Enabled = true; metroLabel18.Text = Convert.ToString(Convert.ToInt32(metroLabel2.Text) + Convert.ToInt32(metroLabel4.Text) + Convert.ToInt32(metroLabel5.Text) - Convert.ToInt32(metroLabel12.Text) - Convert.ToInt32(metroTextBox1.Text) - Convert.ToInt32(metroTextBox2.Text)); }
public int addToDB() { try { AddEmp1 ae1 = new AddEmp1(); EmpInfoLinqDataContext cntx = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); Loans_Leave lo = new Loans_Leave(); lo.Id2 = ae1.id2; lo.LeaveDays = 100; lo.SavingsAccount = 10000; lo.LoanAmount = 0; lo.PayAmount = 0; lo.Year = Convert.ToInt32(DateTime.Now.ToString("yyyy")); taxAndSal trs = new taxAndSal(); trs.Id2 = ae1.id2; trs.PendingTax = 0; /*CheckIn ci = new CheckIn(); * ci.Id2 = ae1.id2; ; * ci.CheckinMark = 0; * ci.PCheckInMark = 0; * ci.CheckInCounter = "0"; * ci.Password = ae1.Pass;*/ EmpInformation emp = new EmpInformation(); emp.Id1 = ae1.id1; emp.Id2 = ae1.id2; emp.Name = ae1.NName; emp.Password = ae1.Pass; emp.PhoneNumber = ae1.PNumber; emp.Rank = ae1.RRank; emp.SalaryGrade = ae1.SalGrade; emp.HomeAddress = ae1.HAddress; emp.EmailAddress = ae1.EAddress; emp.Under = ae.id1 + ae.id2; cntx.EmpInformations.InsertOnSubmit(emp); cntx.Loans_Leaves.InsertOnSubmit(lo); cntx.taxAndSals.InsertOnSubmit(trs); //cntx.CheckIns.InsertOnSubmit(ci); cntx.SubmitChanges(); return(0); } catch { return(1); } }
private void metroTile2_Click(object sender, EventArgs e) { SignInEmp si = new SignInEmp(); EmpInfoLinqDataContext cntx3 = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str3 = from a in cntx3.CheckIns select a; CheckIn p3 = str3.Where(obj => obj.Id2 == metroTextBox4.Text).First(); //EmpInformation em = str.First(); cntx3.CheckIns.DeleteOnSubmit(p3); cntx3.SubmitChanges(); EmpInfoLinqDataContext cntx1 = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str1 = from a in cntx1.taxAndSals select a; taxAndSal p1 = str1.Where(obj => obj.Id2 == metroTextBox4.Text).First(); //EmpInformation em = str.First(); cntx1.taxAndSals.DeleteOnSubmit(p1); cntx1.SubmitChanges(); EmpInfoLinqDataContext cntx2 = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str2 = from a in cntx2.Loans_Leaves select a; Loans_Leave p2 = str2.Where(obj => obj.Id2 == metroTextBox4.Text).First(); //EmpInformation em = str.First(); cntx2.Loans_Leaves.DeleteOnSubmit(p2); cntx2.SubmitChanges(); EmpInfoLinqDataContext cntx = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str = from a in cntx.EmpInformations select a; EmpInformation p = str.Where(obj => obj.Id2 == metroTextBox4.Text).First(); //EmpInformation em = str.First(); cntx.EmpInformations.DeleteOnSubmit(p); cntx.SubmitChanges(); MetroFramework.MetroMessageBox.Show(this, " Deleted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); EmpInfoLinqDataContext cntx5 = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str5 = from a in cntx5.EmpInformations where a.Id1 == si.id1 + 1 select new { Id1 = a.Id1, Id2 = a.Id2, Name = a.Name }; metroGrid1.DataSource = str5; }
private void GeneralEmployeePanel_Load(object sender, EventArgs e) { if (ae1.id1 == 'F') { metroTile2.Enabled = false; } metroLabel10.Text = ae1.NName; metroLabel9.Text = ae1.id1 + ae1.id2; metroLabel8.Text = ae1.RRank; //metroLabel16.Text = ae1.DOB; metroLabel13.Text = ae1.Under; metroLabel7.Text = ae1.PNumber; metroLabel6.Text = ae1.EAddress; metroLabel11.Text = ae1.HAddress; // pictureBox1.Image = Image.FromFile(ae1.Pict); SignInEmp ae = new SignInEmp(); EmpInfoLinqDataContext cntx = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str = from a in cntx.Loans_Leaves select a; Loans_Leave p = str.Where(obj => obj.Id2 == ae.id2).First(); if (Convert.ToInt32(DateTime.Now.ToString("yyyy")) > p.Year) { p.LeaveDays = p.LeaveDays + 100; p.Year = Convert.ToInt32(DateTime.Now.ToString("yyyy")); cntx.SubmitChanges(); } //SignInEmp ae = new SignInEmp(); EmpInfoLinqDataContext cntx1 = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str1 = from a in cntx1.taxAndSals select a; taxAndSal p1 = str1.Where(obj => obj.Id2 == ae.id2).First(); if (p1.Count == 1 && Convert.ToInt32(DateTime.Now.ToString("dd")) > 1) { metroTile5.Enabled = false; } if (p1.Count == 1 && Convert.ToInt32(DateTime.Now.ToString("dd")) == 1) { metroTile5.Enabled = true; p1.Count = 0; cntx.SubmitChanges(); } }
private void metroButton14_Click(object sender, EventArgs e) { SignInEmp si = new SignInEmp(); EmpInfoLinqDataContext cntx1 = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str1 = from a in cntx1.taxAndSals where a.Id2 == si.id2 select a; taxAndSal tt = str1.First(); tt.PendingTax = tt.PendingTax - Convert.ToInt32(metroTextBox1.Text); cntx1.SubmitChanges(); Form2 f = new Form2(); Graphics g = f.CreateGraphics(); bmp = new Bitmap(f.Size.Width, f.Size.Height, g); Graphics mg = Graphics.FromImage(bmp); mg.CopyFromScreen(f.Location.X, f.Location.Y, 0, 0, f.Size); printPreviewDialog1.ShowDialog(); }
private void QueryTax_Load(object sender, EventArgs e) { SignInEmp si = new SignInEmp(); TaxIn ti = new TaxIn(); AddEmp2 ae = new AddEmp2(); FPayment fp = new FPayment(); EmpInfoLinqDataContext cntx = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str = from a in cntx.Loans_Leaves where a.Id2 == si.id2 select a; Loans_Leave tsl = str.First(); metroLabel2.Text = DateTime.Now.ToString("yyyy"); metroLabel32.Text = Convert.ToString(tsl.SavingsAccount); ae.TPayment(); EmpInfoLinqDataContext cntx1 = new EmpInfoLinqDataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\Project Salary Manager\SalaryManager\SalaryManager\EmpployeeInfo.mdf;Integrated Security=True;Connect Timeout=30"); var str1 = from a in cntx1.taxAndSals where a.Id2 == si.id2 select a; taxAndSal tt = str1.First(); metroLabel30.Text = Convert.ToString(tt.PendingTax); }
partial void DeletetaxAndSal(taxAndSal instance);
partial void UpdatetaxAndSal(taxAndSal instance);
partial void InserttaxAndSal(taxAndSal instance);