Beispiel #1
0
        void AddUpateBank()
        {
            try
            {
                ep1.Clear();

                if (string.IsNullOrEmpty(cmbEmployee.Text.Trim()))
                {
                    ep1.SetError(cmbEmployee, "Name is Required..");
                    cmbEmployee.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(txtTotalDay.Text.Trim()))
                {
                    ep1.SetError(txtTotalDay, "Amount is Required..");
                    txtTotalDay.Focus();
                    return;
                }

                decimal dTotal = 0, dDedaction = 0, dSalary = 0, dLoan = 0, dPaid = 0;;
                int     dTotalDay = 0, dTotalHours = 0;

                decimal dDayPrice = 0, dHoursPrice = 0;
                int.TryParse(txtTotalDay.Text.Trim(), out dTotalDay);
                int.TryParse(txtTotalHours.Text.Trim(), out dTotalHours);
                decimal.TryParse(lblDayPrice.Text.Trim(), out dDayPrice);
                decimal.TryParse(lblHoursPrice.Text.Trim(), out dHoursPrice);
                //decimal.TryParse(txtTotal.Text.Trim(), out dTotal);
                //  decimal.TryParse(txtTotalDedaction.Text.Trim(), out dDedaction);
                decimal.TryParse(txtSalary.Text.Trim(), out dSalary);
                decimal.TryParse(lblLoanAmount.Text.Trim(), out dLoan);
                //ecimal.TryParse(txtPaidAmt.Text.Trim(), out dPaid);
                int T14_WORKERID = 0;
                int.TryParse(cmbEmployee.SelectedValue.ToString(), out T14_WORKERID);

                MyDa = new MyDabaseDataContext(Properties.Settings.Default.Style_King_Dev);
                int?Iout = 0;
                MyDa.USP_VP_ADDUPDATES_SALARY(Datalayer.iT16_SALARYID, T14_WORKERID, dtpDate.Value, dTotalDay, dTotalHours, dDayPrice, dHoursPrice, dSalary, dLoan, txtDetails.Text.Trim(), Datalayer.iT001_COMPANYID, ref Iout);
                if (Iout > 0)
                {
                    if (Datalayer.iT16_SALARYID == 0)
                    {
                        Datalayer.InsertMessageBox(sPageName);
                    }
                    else
                    {
                        Datalayer.UpdateMessageBox(sPageName);
                    }
                }
                else
                {
                    if (Datalayer.iT16_SALARYID == 0)
                    {
                        Datalayer.DosenotInsertMessageBox(sPageName);
                    }
                    else
                    {
                        Datalayer.DosenotUpdateMessageBox(sPageName);
                    }
                }

                ResetData();
            }
            catch (Exception ex)
            {
                Datalayer.WorningMessageBox(ex.Message.ToString(), "Error");
            }
        }