Beispiel #1
0
        private void ClearMethod()
        {
            IDTB.Clear();
            FirstNameTB.Clear();
            LastNametextBox.Clear();
            designationtextBox.Clear();
            DepartmentTextBoc.Clear();
            BasicSalarytextBox.Clear();
            ConvancetextBox.Clear();
            MedicalAlltextBox.Clear();
            TotalAmounttextBox.Clear();
            HouseRentTextBoc.Clear();
            AbsenceTextBox.Text    = "0";
            LateTextBox.Text       = "0";
            HalfDayTextBox.Text    = "0";
            OverTimeHrtextBox.Text = "0";
            AddedAllowanceTB.Clear();
            DeductedAmountTB.Clear();
            IncomeTextextBox.Clear();
            NetSalaryTB.Clear();


            Off             = 0;
            NetSalary       = 0;
            Allownc         = 0;
            Deducted        = 0;
            incomeTex       = 0;
            OvertimeAmount  = 0;
            OvertimeHours   = 0;
            TotalAmount     = 0;
            AtdDec          = 0;
            halfDayAmount   = 0;
            button3.Enabled = false;
        }
Beispiel #2
0
        private void GetDataMethod(String ID)
        {
            String ConnString = ConfigurationManager.ConnectionStrings["PayrollConn"].ConnectionString;


            SqlConnection conn = new SqlConnection(ConnString);
            SqlDataReader reader;
            String        sql;

            using (conn)
            {
                //Statuslabel
                sql = "SP_SearchEmployee";
                SqlCommand cmd1 = new SqlCommand(sql, conn);
                cmd1.CommandType = CommandType.StoredProcedure;
                cmd1.Parameters.Add("@id", SqlDbType.VarChar).Value = ID;
                conn.Open();
                reader = cmd1.ExecuteReader();
                reader.Read();
                if (reader.HasRows)
                {
                    // MessageBox.Show(reader[12].ToString());+
                    IDTB.Text            = reader[0].ToString();
                    FirstNameTB.Text     = reader[1].ToString();
                    LastNametextBox.Text = reader[2].ToString();
                    //DateOfBirthTB.Text = reader[3].ToString();
                    //GenderTB.Text = reader[4].ToString();
                    //ContacttextBox.Text = reader[5].ToString();
                    //NICtextBox.Text = reader[6].ToString();
                    //HouseNOtextBox.Text = reader[7].ToString();
                    //AddLine1Tb.Text = reader[8].ToString();
                    //AddLine2tb.Text = reader[9].ToString();
                    //postCodetextBox.Text = reader[10].ToString();
                    DepartmentTextBoc.Text  = reader[11].ToString();
                    designationtextBox.Text = reader[12].ToString();

                    // StatuscomboBox.Text = "" + reader[13];
                    //  DateOfHired.Text = reader[14].ToString();
                    BasicSalarytextBox.Text = reader[15].ToString();
                    // JobTitletextBox.Text = reader[16].ToString();
                    ////PassTb.Text = reader[17].ToString();

                    // dateTimePicker1.Value = DateTime.Now;
                    AddedAllowanceTB.Clear();
                    DeductedAmountTB.Clear();
                    NetSalaryTB.Clear();
                    MonthYear.Enabled = true;
                }
                else
                {
                    MessageBox.Show("It Does Not Exist", "Emply", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }



            try
            {
                int ConvanceAll = 0;
                int MedicalAll  = 0;
                int Houserent   = 0;


                Calculate.Salary(int.Parse(BasicSalarytextBox.Text), ref ConvanceAll, ref Houserent, ref MedicalAll);

                TotalAmount = int.Parse(BasicSalarytextBox.Text);

                TotalAmount += ConvanceAll;
                TotalAmount += MedicalAll;
                TotalAmount += Houserent;


                ConvancetextBox.Text    = "" + ConvanceAll;
                HouseRentTextBoc.Text   = "" + Houserent;
                MedicalAlltextBox.Text  = "" + MedicalAll;
                TotalAmounttextBox.Text = "" + TotalAmount.ToString();
                if (Calculate.IncomeText(int.Parse(BasicSalarytextBox.Text)) == 0)
                {
                    IncomeTextextBox.Text = "No Tex Applied";
                }
                else
                {
                    IncomeTextextBox.Text = "" + Calculate.IncomeText(int.Parse(BasicSalarytextBox.Text));
                    incomeTex             = Calculate.IncomeText(int.Parse(BasicSalarytextBox.Text));
                }
            }
            catch (Exception)
            {
            }
        }