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));
        }
Esempio n. 2
0
 public int salgE()
 {
     try
     {
         SalGr sg = new SalGr();
         if (sg.SAL == 0 || sg.Heal == 0 || sg.HAL == 0 || sg.Dl == 0)
         {
             return(1);
         }
         else
         {
             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.SalaryGs
                       select a;
             SalaryG p = str.Where(obj => obj.SalaryGrade == sg.SLG).First();
             p.Salary    = sg.SAL;
             p.HealthAl  = sg.Heal;
             p.HomeAl    = sg.HAL;
             p.HealthAlp = sg.Heal2;
             p.HomeAlp   = sg.HAL2;
             p.DayAl     = sg.Dl;
             p.Bonus     = sg.BON;
             cntx.SubmitChanges();
             return(0);
         }
     }
     catch { return(1); }
 }
Esempio n. 3
0
        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();
            }
        }
Esempio n. 4
0
        public void getDB()
        {
            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.Id1 == ae.id1 && obj.Id2 == ae.id2 && obj.Password == ae.Pass).First();

            if (ae.id1 == 'A')
            {
                Form1 f  = new Form1();
                Form2 f2 = new Form2(f);

                ae.NName   = p.Name;
                ae.PNumber = p.PhoneNumber;
                ae.Pass    = p.Password;
                //ae.DOB = p.DateofBirth;
                //p.Picture = ae1.Pict;
                ae.SalGrade = p.SalaryGrade;
                ae.HAddress = p.HomeAddress;
                ae.id1      = p.Id1;
                ae.id2      = p.Id2;
                ae.RRank    = p.Rank;
                ae.EAddress = p.EmailAddress;
                f2.S        = 1;
                f.change();
            }
            else
            {
                Form1 f  = new Form1();
                Form2 f2 = new Form2(f);

                /*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.EmpInformations
                 *    select a;
                 * EmpInformation p1 = str1.Where(obj1 => obj1.Id2 == ae.id2).First();*/
                ae.NName   = p.Name;
                ae.PNumber = p.PhoneNumber;
                ae.Pass    = p.Password;
                //p.Picture = ae1.Pict;
                ae.SalGrade = p.SalaryGrade;
                ae.HAddress = p.HomeAddress;
                ae.id1      = p.Id1;
                ae.id2      = p.Id2;
                ae.RRank    = p.Rank;
                ae.EAddress = p.EmailAddress;
                ae.Under    = p.Under;
                //ae.Pict = p1.Division;
                f2.S = 2;
                f.change();
            }
            cntx.SubmitChanges();
        }
Esempio n. 5
0
        public void changeP(string pa)
        {
            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.EmpInformations
                      where a.Id2 == ae.id2
                      select a;
            EmpInformation p = str.First();

            p.Password = pa;
            //ae.Pass = pa;
            cntx.SubmitChanges();
        }
Esempio n. 6
0
        public void editp()
        {
            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.EmpInformations
                      where a.Password == ae.Pass
                      select a;
            EmpInformation p = str.First();

            p.PhoneNumber  = ae.PNumber;
            p.EmailAddress = ae.EAddress;
            p.HomeAddress  = ae.HAddress;
            cntx.SubmitChanges();
        }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 8
0
        public void FLeave()
        {
            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();
            //Loans_Leave p = str.First();
            LoanLeaveC llc = new LoanLeaveC();

            llc.YYear  = Convert.ToInt32(p.Year);
            llc.LeSell = Convert.ToInt32(p.SellLeaveAmount);
            llc.LeaveD = Convert.ToInt32(p.LeaveDays);
            cntx.SubmitChanges();
        }
Esempio n. 9
0
        public void AddLe()
        {
            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
                      where a.Id2 == ae.id2
                      select a;
            Loans_Leave p   = str.First();
            LoanLeaveC  llc = new LoanLeaveC();

            p.LeaveDays       = llc.LeaveD;
            p.Year            = llc.YYear;
            p.SellLeaveAmount = llc.LeSell;
            cntx.SubmitChanges();
        }
        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;
        }
Esempio n. 11
0
        public void fSA()
        {
            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
                      where a.Id2 == ae.id2
                      select a;
            Loans_Leave p  = str.Where(obj => obj.Id2 == ae.id2).First();
            SaveS       sa = new SaveS();

            p.SavingsAccount += sa.SA;
            p.TotalLoan       = sa.TL;
            p.PayAmount       = sa.PA;
            p.LoanAmount      = sa.LA;
            p.LPay            = sa.LP;
            cntx.SubmitChanges();
        }
Esempio n. 12
0
        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();
        }