Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String Name = (txtName.Text);
            int    HourlyWage;
            int    SocialSecurtiy;
            int    HoursWorked;
            double NetPay;
            double GrossPay;
            double Federal;
            double State;
            double Tax;

            HourlyWage     = Convert.ToInt32(txtPayRate.Text);
            HoursWorked    = Convert.ToInt32(txtHoursWorked.Text);
            SocialSecurtiy = Convert.ToInt32(txtSocial.Text);

            GrossPay = HourlyWage * HoursWorked;
            State    = GrossPay / 5;
            Federal  = GrossPay / 15;
            Tax      = State + Federal;
            NetPay   = GrossPay - Tax;

            lblGrossPay.Text = "" + GrossPay.ToString("C");
            lblFederal.Text  = "" + Federal.ToString("C");
            lblState.Text    = "" + State.ToString("C");
            lblNet.Text      = "" + NetPay.ToString("C");
        }
Esempio n. 2
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                foreach (DataGridViewRow item in this.dataGridView1.SelectedRows)
                {
                    double discountRate = Convert.ToDouble(txtDiscount.Text) / 100;
                    int    v            = int.Parse(item.Cells[4].Value.ToString());
                    dataGridView1.Rows.RemoveAt(item.Index);
                    TotalAmount     -= v;
                    Discount         = discountRate * TotalAmount;
                    NetPay           = TotalAmount - Discount;
                    lblTotal.Text    = TotalAmount.ToString();
                    lblDiscount.Text = Discount.ToString();
                    lblNetPay.Text   = NetPay.ToString();
                }

                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    dataGridView1.Rows[i].Cells[0].Value = i + 1;
                }
            }
            else
            {
                MessageBox.Show("Please select row to remove!", "Invalid", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
            }
        }
 public override string ToString()
 {
     return(Id + " "
            + FirstName + " "
            + LastName + " "
            + GrossPay.ToString("C") + " "
            + FederalTax.ToString("C") + " "
            + StateTax.ToString("C") + " "
            + NetPay.ToString("C"));
 }
Esempio n. 4
0
        //2004签名
        public static string sign(string MerId, string OrdId, string TransAmt, string CuryId, string TransDate, string TransType)
        {
            //NetPayClientClass a = new NetPayClientClass();
            NetPay a = new NetPay();

            //设置密钥文件地址
            a.buildKey(MerId, 0, priKeyPath);

            // 对一段字符串的签名
            return(a.signOrder(MerId, OrdId, TransAmt, CuryId, TransDate, TransType));
        }
Esempio n. 5
0
 public ChinaPayUtils()
 {
     refundPostData = new RefundPostData
     {
         MerID     = MerId,
         Version   = Version,
         TransType = TransType
     };
     netPay = new NetPay();
     //设置密钥文件地址
     netPay.buildKey(MerId, 0, PriKeyPath);
 }
Esempio n. 6
0
        //签名
        public static string signData(string merId, string plain, string priKeyPath)
        {
            byte[] StrRes = Encoding.GetEncoding("gbk").GetBytes(plain);
            plain = Convert.ToBase64String(StrRes);

            NetPay a = new NetPay();

            //设置密钥文件地址
            a.buildKey(merId, 0, priKeyPath);

            // 对一段字符串的签名
            return(a.Sign(plain));
        }
        //签名
        public static string sign(string MerId, string plain)
        {
            NetPay netPay = new NetPay();
            Boolean flag = netPay.buildKey(MerId, 0, NetConfig.priKeyPath);
            string sign = null;
            if (flag)
            {
                if (netPay.PrivateKeyFlag)
                {
                    sign = netPay.Sign(plain);
                }
            }
            return sign;

        }
Esempio n. 8
0
    //签名
    public static string sign(string MerId, string plain)
    {
        NetPay  netPay = new NetPay();
        Boolean flag   = netPay.buildKey(MerId, 0, SignData.priKeyPath);
        string  sign   = null;

        if (flag)
        {
            if (netPay.PrivateKeyFlag)
            {
                sign = netPay.Sign(plain);
            }
        }
        return(sign);
    }
Esempio n. 9
0
        private void btnNetPay_Click(object sender, EventArgs e)
        {
            double Hours, Rate;
            double GrossPay, FederalTax, StateTax, NetPay;

            Hours      = Convert.ToDouble(txtAmountWorked.Text);
            Rate       = Convert.ToDouble(txtHourlyDailyMonthlyRate.Text);
            GrossPay   = Hours * Rate;
            FederalTax = GrossPay * 0.15;
            StateTax   = GrossPay * 5 / 100;
            NetPay     = GrossPay - (FederalTax + StateTax);

            txtGrossPay.Text   = GrossPay.ToString("c");
            txtStateTax.Text   = StateTax.ToString("c");
            txtFederalTax.Text = FederalTax.ToString("c");
            txtNetPay.Text     = NetPay.ToString("c");
        }
Esempio n. 10
0
        //验签
        public static string checkData(string plain, string ChkValue, string pubKeyPath)
        {
            byte[] StrRes = Encoding.GetEncoding("gbk").GetBytes(plain);
            plain = Convert.ToBase64String(StrRes);

            NetPay a = new NetPay();

            //设置密钥文件地址
            a.buildKey("999999999999999", 0, pubKeyPath);

            // 对一段字符串的签名
            if (a.verifyAuthToken(plain, ChkValue))
            {
                return("0");
            }
            else
            {
                return("-118");
            }
        }
Esempio n. 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            double hours, rate;
            double FederalTax, NetPay, StateTax, GrossPay;

            /* Console.Write("Please Enter the number of hours worked");
             * String input = Console.ReadLine();
             * double hours = double.Parse
             */
            hours = Convert.ToDouble(textBox_HoursWorked.Text);
            rate  = Convert.ToDouble(textBox_HourlyRate.Text);

            GrossPay   = hours * rate;
            FederalTax = GrossPay * 0.15;
            StateTax   = GrossPay * 0.05;
            NetPay     = GrossPay - (FederalTax + StateTax);

            textBoxGrossPay.Text = GrossPay.ToString("C");
            textBoxFedTax.Text   = FederalTax.ToString("C");
            textBoxStateTax.Text = StateTax.ToString("C");
            textBoxNetPay.Text   = NetPay.ToString("C");
        }
Esempio n. 12
0
    //验签
    public static bool check(string MerId, string OrdId, string TransAmt, string CuryId, string TransDate, string TransType, string status, string ChkValue)
    {
        NetPay  netPay = new NetPay();
        Boolean flag   = netPay.buildKey("999999999999999", 0, SignData.pubKeyPath);

        if (flag)
        {
            if (netPay.PublicKeyFlag)
            {
                flag = netPay.verifyTransResponse(MerId, OrdId, TransAmt, CuryId, TransDate, TransType, status, ChkValue);
            }
            else
            {
                flag = false;
            }
        }
        else
        {
            flag = false;
        }

        return(flag);
    }
        //验签
        public static bool check(string MerId, string OrdId, string TransAmt, string CuryId, string TransDate, string TransType, string status, string ChkValue)
        {

            NetPay netPay = new NetPay();
            Boolean flag = netPay.buildKey("999999999999999", 0, NetConfig.pubKeyPath);
            if (flag)
            {
                if (netPay.PublicKeyFlag)
                {
                    flag = netPay.verifyTransResponse(MerId, OrdId, TransAmt, CuryId, TransDate, TransType, status, ChkValue);
                }
                else
                {
                    flag = false;
                }
            }
            else
            {
                flag = false;
            }

            return flag;

        }
Esempio n. 14
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                var selectedItem = cmbProduct.SelectedItem as ComboboxItem;
                ProID = Convert.ToInt32(selectedItem.Value);
                string         cmdtext = "SELECT productName,purchasePrice FROM tblProducts WHERE productID=" + ProID;
                SqlDataAdapter sda     = new SqlDataAdapter(cmdtext, c.con);
                DataTable      dt      = new DataTable();
                sda.Fill(dt);



                int    pId          = ProID;
                string pName        = dt.Rows[0][0].ToString();
                int    pQuantity    = int.Parse(txtQuantity.Text);
                double unitPrice    = Convert.ToDouble(dt.Rows[0][1]);
                double tamount      = unitPrice * pQuantity;
                double discountRate = Convert.ToDouble(txtDiscount.Text) / 100;



                dataGridView1.Rows.Add(dataGridView1.Rows.Count, pName, unitPrice, pQuantity, tamount, pId);
                TotalAmount     += tamount;
                Discount         = discountRate * TotalAmount;
                NetPay           = TotalAmount - Discount;
                lblTotal.Text    = TotalAmount.ToString();
                lblDiscount.Text = Discount.ToString();
                lblNetPay.Text   = NetPay.ToString();
                ClearFields();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
            }
        }
        public void ValidateUpdateEmployeeInfo()
        {
            AddEmployeeDialogBox         addEmp    = new AddEmployeeDialogBox(driver);
            EmployeeBenifitDashboardPage dashboard = new EmployeeBenifitDashboardPage(driver);

            Actions.LoginToEmployeeBenifitDashboard(Config.Credentials.Valid.Username, Config.Credentials.Valid.Password, driver);

            //Get count before adding an employee
            int countOfLastNames  = dashboard.LastNameList.Count;
            int countOfFirstNames = dashboard.FirstNameList.Count;
            int countOfDependents = dashboard.DependentsList.Count;
            int i;

            string UpdateFirstName = "Mike";
            string UpdateLastName  = "Scott";

            string  existingFirstName = "";
            string  existingLastName  = "";
            string  existingDependent = "";
            string  existingID;
            string  Id;
            int     j;
            int     dependents;
            decimal BenifitsCost;
            decimal NetPay;
            string  updatedFirstName  = Config.EmployeeInfo.UpdateEmployeeInfo.FirstName;
            string  updatedLastName   = Config.EmployeeInfo.UpdateEmployeeInfo.LastName;
            string  updatedDependents = Config.EmployeeInfo.UpdateEmployeeInfo.NumberOfDependents;

            try
            {
                for (i = 0; i <= countOfLastNames; i++)
                {
                    existingLastName = dashboard.FirstNameList[i].Text;
                    if (existingLastName == UpdateLastName)
                    {
                        existingFirstName = dashboard.LastNameList[i].Text;
                        if (existingFirstName == UpdateFirstName)
                        {
                            existingDependent = dashboard.DependentsList[i].Text;
                            if (existingDependent == "2")
                            {
                                dashboard.EditActionList[i].Click();
                                Actions.UpdateEmployee(Config.EmployeeInfo.UpdateEmployeeInfo.FirstName, Config.EmployeeInfo.UpdateEmployeeInfo.LastName, Config.EmployeeInfo.UpdateEmployeeInfo.NumberOfDependents, driver);
                                Id = dashboard.IdList[i].Text;

                                for (j = 0; j <= countOfLastNames; j++)
                                {
                                    existingLastName = dashboard.FirstNameList[j].Text;
                                    if (existingLastName == updatedLastName)
                                    {
                                        existingFirstName = dashboard.LastNameList[i].Text;
                                        if (existingFirstName == updatedFirstName)
                                        {
                                            existingDependent = dashboard.DependentsList[i].Text;
                                            if (existingDependent == updatedDependents)
                                            {
                                                existingID = dashboard.IdList[i].Text;
                                                if (Id == existingID)
                                                {
                                                    Assert.IsTrue(true);
                                                    dependents   = Int32.Parse(updatedDependents);
                                                    BenifitsCost = Actions.BenifitCalculation(dependents, driver);
                                                    string CalBenifitCost = BenifitsCost.ToString();
                                                    Assert.AreEqual(CalBenifitCost, dashboard.BenefitsCostList[i].Text);
                                                    NetPay = Actions.NetPayCalcualtion(BenifitsCost, driver);
                                                    string CalNetPay = NetPay.ToString();
                                                    Assert.AreEqual(CalNetPay, dashboard.NetPayList[i].Text);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                dashboard.LogOutLink.Click();
            }
        }
Esempio n. 16
0
        public void ValidateAddedValidEmployee()
        {
            AddEmployeeDialogBox         addEmp    = new AddEmployeeDialogBox(driver);
            EmployeeBenifitDashboardPage dashboard = new EmployeeBenifitDashboardPage(driver);

            Actions.LoginToEmployeeBenifitDashboard(Config.Credentials.Valid.Username, Config.Credentials.Valid.Password, driver);

            //Get count before adding an employee
            int countOfLastNames  = dashboard.LastNameList.Count;
            int countOfFirstNames = dashboard.FirstNameList.Count;
            int countOfDependents = dashboard.DependentsList.Count;


            dashboard.AddEmployeeButton.Click();
            string fntext  = Config.EmployeeInfo.ValidEmployeeInfo.FirstName;
            string lntext  = Config.EmployeeInfo.ValidEmployeeInfo.LastName;
            string deptext = Config.EmployeeInfo.ValidEmployeeInfo.NumberOfDependents;

            Actions.AddEmployee(Config.EmployeeInfo.ValidEmployeeInfo.FirstName, Config.EmployeeInfo.ValidEmployeeInfo.LastName, Config.EmployeeInfo.ValidEmployeeInfo.NumberOfDependents, driver);

            Thread.Sleep(3000);

            int countofLastNameafterAddition  = dashboard.LastNameList.Count;
            int countOfFirstNameafterAddition = dashboard.FirstNameList.Count;

            countOfFirstNames = countOfFirstNames + 1;
            countOfLastNames  = countOfLastNames + 1;

            Assert.AreEqual(countOfFirstNameafterAddition, countOfFirstNames);

            Assert.AreEqual(countofLastNameafterAddition, countOfLastNames);
            string  addedFirstName = "";
            string  addedLastName  = "";
            string  addedDependent = "";
            int     i;
            int     dependents;
            decimal BenifitsCost;
            decimal NetPay;

            for (i = 0; i <= countOfLastNames; i++)
            {
                addedFirstName = dashboard.LastNameList[i].Text;



                if (fntext == addedFirstName)
                {
                    addedLastName = dashboard.FirstNameList[i].Text;
                    if (lntext == addedLastName)
                    {
                        addedDependent = dashboard.DependentsList[i].Text;
                        if (deptext == addedDependent)
                        {
                            Assert.IsTrue(true);
                            dependents   = Int32.Parse(addedDependent);
                            BenifitsCost = Actions.BenifitCalculation(dependents, driver);
                            string CalBenifitCost = BenifitsCost.ToString();
                            Assert.AreEqual(CalBenifitCost, dashboard.BenefitsCostList[i].Text);
                            NetPay = Actions.NetPayCalcualtion(BenifitsCost, driver);
                            string CalNetPay = NetPay.ToString();
                            Assert.AreEqual(CalNetPay, dashboard.NetPayList[i].Text);
                            break;
                        }
                    }
                }
            }

            Thread.Sleep(3000);
        }
Esempio n. 17
0
        private void btnPayRoll_Click(object sender, EventArgs e)
        {
            String Name = (txtName.Text);
            int    Security;
            int    HourlyPay;
            int    HoursWorked;
            double NetPay;
            double State;
            double Federal;
            double GrossPay;
            double Tax;

            HourlyPay   = Convert.ToInt32(txtHourlyPay.Text);
            HoursWorked = Convert.ToInt32(txtHoursWorked.Text);
            Security    = Convert.ToInt32(txtSocialSecurity.Text);

            GrossPay = HourlyPay * HoursWorked;
            Federal  = GrossPay / 15;
            State    = GrossPay / 5;
            Tax      = Federal + State;
            NetPay   = GrossPay - Tax;


            lblPayRoll.Text = "Hello " + Name + " Social Security( " + Security + ") , Gross Pay is " + GrossPay.ToString("c") + ". Federal is " + Federal.ToString("c") + " and State is " + State.ToString("c") + ".Your Net Pay is now " + NetPay.ToString("c");
        }