예제 #1
0
        private void giveSalary_button_Click(object sender, EventArgs e)
        {
            try
            {
                if (serachMembertextBox.Text != "" && signUpFirstNamemetroTextBox.Text != "")
                {
                    if (year_comboBox.Text != "" && month_comboBox.Text != "")
                    {
                        if (MessageBox.Show("Are you sure?", "Give Member Salary", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                        {
                            SalaryHistory salaryHistory = new SalaryHistory();
                            salaryHistory.UserName = serachMembertextBox.Text;
                            salaryHistory.year = year_comboBox.Text;
                            salaryHistory.month = month_comboBox.Text;
                            salaryHistory.recieveAdvance = recievedadvance_textBox.Text;
                            salaryHistory.basicSalary = basicSalary_textBox.Text;
                            salaryHistory.totalAttendence = totalAttendence_textBox.Text;
                            //salaryHistory.servicingAmount = totalservicingAmount_textBox.Text;
                            salaryHistory.prouctSellProfitAmount = productSell_textBox.Text;
                            salaryHistory.festivalBonus = festivalBonus_comboBox.Text;
                            //salaryHistory.servicingBonus = servicingBonus_comboBox.Text;
                            salaryHistory.sellBonus = sell_comboBox.Text;
                            salaryHistory.totalsalary = totalTobePaid_textBox.Text;

                            try
                            {
                                totalDays = DateTime.DaysInMonth(Convert.ToInt32(year_comboBox.Text), Convert.ToInt32(month_comboBox));
                            }
                            catch
                            {

                            }
                             salaryHistory.date = year_comboBox.Text +"/"+ month+"/"+ totalDays.ToString();
                            // MessageBox.Show(salaryHistory.year+"    "+salaryHistory.month+"    "+salaryHistory.UserName+"  "+salaryHistory.totalAttendence+ "   "+salaryHistory.basicSalary+"  "+salaryHistory.recieveAdvance+"    "+salaryHistory.servicingAmount+"   "+salaryHistory.prouctSellProfitAmount+"    "+salaryHistory.servicingBonus+"    "+salaryHistory.festivalBonus+"     "+salaryHistory.sellBonus+" "+salaryHistory.totalsalary+"   "+salaryHistory.date);
                            if(account_Bo.setSalaryHistory(salaryHistory))
                            {
                                //string connString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\DB\Database.mdf;Integrated Security=True";
                                //SqlConnection conn = new SqlConnection(connString);
                                //SqlCommand cmd = new SqlCommand("Insert into SalaryHistory values('"+year_comboBox.Text+"','"+month_comboBox.Text+"','"+serachMembertextBox.Text+"','"+totalAttendence_textBox.Text+"','"+basicSalary_textBox.Text+"','"+recievedadvance_textBox.Text+"','"+ totalservicingAmount_textBox.Text+"','"+productSell_textBox.Text+"','"+servicingBonus_comboBox.Text+"','"+festivalBonus_comboBox.Text+"','"+sell_comboBox.Text+"','"+totalTobePaid_textBox.Text+"','"+date+"')", conn);
                                //conn.Open();
                                //cmd.ExecuteNonQuery();
                                //conn.Close();

                                MessageBox.Show("Salary paid successfully done");

                                Expenditure expenditure = new Expenditure();
                                expenditure.date = dateTimePicker3.Text;
                                expenditure.amount = totalTobePaid_textBox.Text;
                                expenditure.description = "MemberSalary";
                                account_Bo.setExpenditure(expenditure);

                                month_comboBox.ResetText();
                                year_comboBox.ResetText();
                                basicSalary_textBox.Clear();
                                totalAttendence_textBox.Clear();
                                recievedadvance_textBox.Clear();
                                totalTobePaid_textBox.Clear();
                                //servicingBonus_comboBox.ResetText();
                                festivalBonus_comboBox.ResetText();
                               // totalservicingAmount_textBox.Clear();
                                sell_comboBox.ResetText();
                                productSell_textBox.Clear();

                            }
                            else
                            {
                                MessageBox.Show("Already paid");
                                month_comboBox.ResetText();
                                year_comboBox.ResetText();
                                basicSalary_textBox.Clear();
                                totalAttendence_textBox.Clear();
                                recievedadvance_textBox.Clear();
                                totalTobePaid_textBox.Clear();
                                //servicingBonus_comboBox.ResetText();
                                festivalBonus_comboBox.ResetText();
                                //totalservicingAmount_textBox.Clear();
                                sell_comboBox.ResetText();
                                productSell_textBox.Clear();
                            }

                        }

                    }
                    else
                    {
                        MessageBox.Show("Please enter the information fully");
                    }
                }
                else
                {
                    MessageBox.Show("Please select a member first");

                }
            }
            catch
            {
                MessageBox.Show("Already paid");
                month_comboBox.ResetText();
                year_comboBox.ResetText();
                basicSalary_textBox.Clear();
                totalAttendence_textBox.Clear();
                recievedadvance_textBox.Clear();
                totalTobePaid_textBox.Clear();
                //servicingBonus_comboBox.ResetText();
                festivalBonus_comboBox.ResetText();
                //totalservicingAmount_textBox.Clear();
                sell_comboBox.ResetText();
                productSell_textBox.Clear();
            }
        }
        private void save_btn_Click(object sender, EventArgs e)
        {
            try
            {
                if (expenditureAmount_Txtbox.Text != "" && expenditureDescription_Txtbox.Text != "")
                {
                    Expenditure expenditure = new Expenditure();
                    expenditure.date = expendituredateTimePicker.Text;
                    expenditure.amount = expenditureAmount_Txtbox.Text;
                    expenditure.description = expenditureDescription_Txtbox.Text;
                    if (MessageBox.Show("Are you sure?", "Add Income", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        if (account_Bo.setHardwareIncome(expenditure))
                        {
                            MessageBox.Show("Servicing income entry succefully done");
                            expendituredateTimePicker.ResetText();
                            expenditureAmount_Txtbox.Clear();
                            expenditureDescription_Txtbox.Clear();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Enter the information fully");
                }
            }
            catch
            {

            }
        }
예제 #3
0
 public bool setHardwareIncome(Expenditure expenditure)
 {
     return account_DAL.setHardwareIncome(expenditure);
 }
예제 #4
0
 //Expenditure
 public bool setExpenditure(Expenditure expenditure)
 {
     return account_DAL.setExpenditure(expenditure);
 }
예제 #5
0
파일: DAL.cs 프로젝트: RiazMahmud/Cozy66
 //expenditure
 public bool setExpenditure(Expenditure expenditure)
 {
     try
     {
         SqlConnection conn = new SqlConnection(connString);
         SqlCommand cmd = new SqlCommand("SetExpenditure", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@Date", SqlDbType.NVarChar, 10).Value = expenditure.date;
         cmd.Parameters.Add("@Amount", SqlDbType.NVarChar, 30).Value = expenditure.amount;
         cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = expenditure.description;
         conn.Open();
         cmd.ExecuteNonQuery();
         conn.Close();
         return true;
     }
     catch
     {
         return false;
     }
 }