コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext())
                {
                    
                    Validationfieldnum(textBox2);
                    Validationfieldnumamount(txtCashamount);
                    Validationfieldnumamount(txtChequeAmount);
                    Church_AmountDetail obj = new Church_AmountDetail();
                    if (textBox1.Text != string.Empty)
                    {
                        obj.Card_No = Convert.ToInt64(textBox1.Text);
                    }
                    else
                    {
                        textBox1.Focus();
                        throw new Exception("Enter Card No!");
                    }
                    if (textBox2.Text != string.Empty)
                    {
                        obj.Recipt_No = textBox2.Text;
                    }
                    else
                    {
                        textBox2.Focus();
                        throw new Exception("Enter Recipt_No!");
                    }
                    if (textBox3.Text == string.Empty)
                    {
                        textBox3.Focus();
                        throw new Exception("Enter Towards!");
                    }
                    if (checkBox2.Checked || checkBox1.Checked)
                    {
                        if (checkBox2.Checked)
                        {
                            if (txtCashamount.Text != string.Empty)
                            {
                                obj.Cash_Amount = Convert.ToDecimal(txtCashamount.Text);
                            }
                            else
                            {
                                txtCashamount.Focus();
                                throw new Exception("Enter Amount!");
                            }
                        }
                        else
                        {
                            txtCashamount.Text = "0";
                            obj.Cash_Amount = 0;
                        }
                        if (checkBox1.Checked)
                        {
                            if (txtChequeAmount.Text != string.Empty && txtChequeno.Text != string.Empty && txtBranch.Text != string.Empty)
                            {
                                obj.Bank_Name = Convert.ToInt32(comboBox2.SelectedValue);
                                obj.Branch_Name = txtBranch.Text;
                                obj.Cheque_No = txtChequeno.Text;
                                obj.Cheque_Date = Convert.ToDateTime(ChequeDate.Text);
                                obj.Cheque_Amount = Convert.ToDecimal(txtChequeAmount.Text);
                            }
                            else
                            {
                                throw new Exception("Fill all cheque enabled fields!");
                            }
                        }
                        else
                        {
                            txtChequeAmount.Text = "0";
                            obj.Cheque_Amount = 0;
                        }
                        obj.Payment_Date = Convert.ToDateTime(dateTimePicker1.Text);
                        obj.Register_Date = DateTime.Now;
                        obj.Form_id = 2;
                        churchDB.Church_AmountDetails.InsertOnSubmit(obj);
                        churchDB.SubmitChanges();
                        long aa = (from a in churchDB.Church_AmountDetails select a.Amount_Id).Max();
                        Church_HouseVisitDetail mun = new Church_HouseVisitDetail();
                        mun.Towards = textBox3.Text;
                        mun.FK_Amountid = aa;
                        churchDB.Church_HouseVisitDetails.InsertOnSubmit(mun);
                        churchDB.SubmitChanges();
                        var amount = (from a in churchDB.Church_OpeningBalanceDetails where a.Account_type == 1 select a).FirstOrDefault();
                        amount.Opening_Bal_Cash = amount.Opening_Bal_Cash + Convert.ToDecimal(txtCashamount.Text) + Convert.ToDecimal(txtChequeAmount.Text);
                        churchDB.SubmitChanges();
                        MessageBox.Show("Submit Successfully");
                        emptyfield();
                    }
                    else
                    {
                        throw new Exception("Check any one Cash or Cheque!");
                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext())
         {
             var bal = from a in churchDB.Church_AuctionStatus where a.Card_No == Convert.ToInt64(textBox1.Text) select a;
             if (bal.Count() == 1)
             {
                 Validationfieldnum(textBox2);
                 Validationfieldnumamount(txtCashamount);
                 Validationfieldnumamount(txtChequeAmount);
                 Church_AmountDetail obj = new Church_AmountDetail();
                 if (textBox1.Text != string.Empty)
                 {
                     obj.Card_No = Convert.ToInt64(textBox1.Text);
                 }
                 else
                 {
                     textBox1.Focus();
                     throw new Exception("Enter Card No!");
                 }
                 if (textBox2.Text != string.Empty)
                 {
                     obj.Recipt_No = textBox2.Text;
                 }
                 else
                 {
                     textBox2.Focus();
                     throw new Exception("Enter Recipt_No!");
                 }
                 if (checkBox2.Checked || checkBox1.Checked)
                 {
                     if (checkBox2.Checked)
                     {
                         if (txtCashamount.Text != string.Empty)
                         {
                             obj.Cash_Amount = Convert.ToDecimal(txtCashamount.Text);
                         }
                         else
                         {
                             txtCashamount.Focus();
                             throw new Exception("Enter Amount!");
                         }
                     }
                     else
                     {
                         txtCashamount.Text = "0";
                         obj.Cash_Amount = 0;
                     }
                     if (checkBox1.Checked)
                     {
                         if (txtChequeAmount.Text != string.Empty && txtChequeno.Text != string.Empty && txtBranch.Text != string.Empty)
                         {
                             obj.Bank_Name = Convert.ToInt32(comboBox2.SelectedValue);
                             obj.Branch_Name = txtBranch.Text;
                             obj.Cheque_No = txtChequeno.Text;
                             obj.Cheque_Date = Convert.ToDateTime(ChequeDate.Text);
                             obj.Cheque_Amount = Convert.ToDecimal(txtChequeAmount.Text);
                         }
                         else
                         {
                             throw new Exception("Fill all cheque enabled fields!");
                         }
                     }
                     else
                     {
                         txtChequeAmount.Text = "0";
                         obj.Cheque_Amount = 0;
                     }
                     obj.Payment_Date = Convert.ToDateTime(dateTimePicker1.Text);
                     obj.Register_Date = DateTime.Now;
                     obj.Form_id = 4;
                     churchDB.Church_AmountDetails.InsertOnSubmit(obj);
                     churchDB.SubmitChanges();
                     
                     var cal = (from a in churchDB.Church_AuctionStatus where a.Card_No == Convert.ToInt64(textBox1.Text) select a).First();
                     if (txtCashamount.Text == string.Empty)
                     {
                         txtCashamount.Text = Convert.ToString(0);
                     }
                     if (txtChequeAmount.Text == string.Empty)
                     {
                         txtChequeAmount.Text = Convert.ToString(0);
                     }
                     cal.Sunday_Action_Payed = cal.Sunday_Action_Payed + Convert.ToDecimal(txtCashamount.Text) + Convert.ToDecimal(txtChequeAmount.Text);
                     churchDB.SubmitChanges();
                     var amount = (from a in churchDB.Church_OpeningBalanceDetails where a.Account_type == 1 select a).FirstOrDefault();
                     amount.Opening_Bal_Cash = amount.Opening_Bal_Cash + Convert.ToDecimal(txtCashamount.Text) + Convert.ToDecimal(txtChequeAmount.Text);
                     churchDB.SubmitChanges();
                     MessageBox.Show("Submit Successfully");
                     Bindingamount();
                     emptyfield();
                 }
                 else
                 {
                     throw new Exception("Check any one Cash or Cheque!");
                 }
             }
             else
             {
                 throw new Exception("Person Cann't get any auction!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #3
0
        //private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    if (comboBox1.SelectedIndex == 1)
        //    {

        //        label18.Visible = true;
        //        txtCardno.Visible = true;
        //        //label19.Visible = true;
        //    }
        //    else
        //    {
        //       // label19.Visible = false;
        //        label18.Visible = false;
        //        txtCardno.Visible = false;
        //    }
        //}

        public void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //Validationfieldnum(txtCardno);
                Validationfieldnum(txtCashamount);
                Validationfieldnum(txtChequeAmount);
                using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext())
                {

                    Church_GeneralOfferingDetail obj = new Church_GeneralOfferingDetail();
                    Church_AmountDetail obj1 = new Church_AmountDetail();
                    if (comboBox3.Text=="Others")
                    {
                        textBox10.Focus();
                        throw new Exception("Enter Offer Name!");
                    }
                    if (checkBox2.Checked || checkBox1.Checked)
                    {
                        //if (comboBox1.SelectedIndex == 1)
                        //{
                        //    if (txtCardno.Text != string.Empty)
                        //    {
                        //        if ((from a in churchDB.Church_MemberDetails where a.CardNo == Convert.ToInt64(txtCardno.Text) select a.MemberName).SingleOrDefault() != null)
                        //        {
                        //            obj.Cardno = Convert.ToInt64(txtCardno.Text);
                        //            obj.MainCatagory = comboBox1.SelectedIndex;

                        //        }
                        //        else
                        //        {
                        //            obj.MainCatagory = 0;
                        //            if (System.Windows.Forms.MessageBox.Show("it's not a valid Card No;Do you want to Save in general?", "Conformation", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Asterisk, System.Windows.Forms.MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.OK)
                        //            {
                        //            }
                        //            else
                        //            {
                        //                throw new Exception("Record Discarded!");
                        //            }
                        //        }
                        //    }
                        //    else
                        //    {
                        //        txtCardno.Focus();
                        //        throw new Exception("Enter the Card No!");
                        //    }
                        //}
                        //else
                        //{
                        //    obj.MainCatagory = comboBox1.SelectedIndex;
                        //}
                        if (checkBox2.Checked)
                        {
                            if (txtCashamount.Text != string.Empty)
                            {
                                obj1.Cash_Amount = Convert.ToDecimal(txtCashamount.Text);
                                if (!checkBox3.Checked)
                                {
                                    obj._1000x = Convert.ToInt32(textBox1.Text);
                                    obj._500x = Convert.ToInt32(textBox2.Text);
                                    obj._100x = Convert.ToInt32(textBox3.Text);
                                    obj._50x = Convert.ToInt32(textBox4.Text);
                                    obj._20x = Convert.ToInt32(textBox5.Text);
                                    obj._10x = Convert.ToInt32(textBox6.Text);
                                    obj._5x = Convert.ToInt32(textBox7.Text);
                                    obj._2x = Convert.ToInt32(textBox8.Text);
                                    obj._1x = Convert.ToInt32(textBox9.Text);
                                }
                            }
                            else
                            {
                                txtCashamount.Focus();
                                throw new Exception("Enter Amount!");
                            }
                        }
                        else
                        {
                            txtCashamount.Text = "0";
                            obj1.Cash_Amount = 0;
                        }
                        if (checkBox1.Checked)
                        {
                            if (txtChequeAmount.Text != string.Empty && txtChequeno.Text != string.Empty && txtBranch.Text != string.Empty)
                            {
                                obj1.Bank_Name = Convert.ToInt32(comboBox2.SelectedValue);
                                obj1.Branch_Name = txtBranch.Text;
                                obj1.Cheque_No = txtChequeno.Text;
                                obj1.Cheque_Date = Convert.ToDateTime(ChequeDate.Text);
                                obj1.Cheque_Amount = Convert.ToDecimal(txtChequeAmount.Text);
                            }
                            else
                            {
                                throw new Exception("Fill all cheque enabled fields!");
                            }
                        }
                        else
                        {
                            txtChequeAmount.Text = "0";
                            obj1.Cheque_Amount = 0;
                        }
                        obj.Offering_type = Convert.ToInt32(comboBox3.SelectedValue);
                        obj1.Register_Date = DateTime.Now;
                        obj1.Payment_Date = Convert.ToDateTime(dateTimePicker1.Text);
                        obj1.Form_id = 7;
                        churchDB.Church_AmountDetails.InsertOnSubmit(obj1);
                        churchDB.SubmitChanges();
                        long aa = (from a in churchDB.Church_AmountDetails select a.Amount_Id).Max();
                        obj.FK_Amountid = aa;
                        churchDB.Church_GeneralOfferingDetails.InsertOnSubmit(obj);
                        churchDB.SubmitChanges();
                        var amount = (from a in churchDB.Church_OpeningBalanceDetails where a.Account_type == 1 select a).FirstOrDefault();
                        amount.Opening_Bal_Cash = amount.Opening_Bal_Cash + Convert.ToDecimal(txtCashamount.Text) + Convert.ToDecimal(txtChequeAmount.Text);
                        churchDB.SubmitChanges();
                        MessageBox.Show("Save Successfully!");
                    }
                    else
                    {
                        throw new Exception("Enable check box Cash or Cheque!!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
コード例 #4
0
ファイル: Harvest.cs プロジェクト: chutinhha/onlineexampro
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         Validationfieldnumamount(textBox3);
         Validationfieldnumamount(txtCashamount);
         Validationfieldnumamount(txtChequeAmount);
         using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext())
         {
             Church_AmountDetail obj = new Church_AmountDetail();
             Church_Auction_Detail obj1 = new Church_Auction_Detail();
             if (checkBox2.Checked || checkBox1.Checked)
             {
                 if (textBox1.Text != "")
                 {
                     obj.Card_No = Convert.ToInt64(textBox1.Text);
                 }
                 else
                 {
                     textBox1.Focus();
                     throw new Exception("Enter Card No!");
                 }
                 if (textBox2.Text != "")
                 {
                     obj1.Thing_Name = textBox2.Text;
                 }
                 else
                 {
                     textBox2.Focus();
                     throw new Exception("Enter Things Name!");
                 }
                 if (textBox3.Text == "")
                 {
                     textBox3.Focus();
                     throw new Exception("Enter the Original Prize!");
                 }
                 if (textBox4.Text == "")
                 {
                     textBox4.Focus();
                     throw new Exception("Enter the receipt No!");
                 }
                 if (checkBox2.Checked)
                 {
                     if (txtCashamount.Text != string.Empty)
                     {
                         obj.Cash_Amount = Convert.ToDecimal(txtCashamount.Text);
                     }
                     else
                     {
                         txtCashamount.Focus();
                         throw new Exception("Enter Amount!");
                     }
                 }
                 else
                 {
                     txtCashamount.Text = "0";
                     obj.Cash_Amount = 0;
                 }
                 if (checkBox1.Checked)
                 {
                     if (txtChequeAmount.Text != string.Empty && txtChequeno.Text != string.Empty && txtBranch.Text != string.Empty)
                     {
                         obj.Bank_Name = Convert.ToInt32(comboBox2.SelectedValue);
                         obj.Branch_Name = txtBranch.Text;
                         obj.Cheque_No = txtChequeno.Text;
                         obj.Cheque_Date = Convert.ToDateTime(ChequeDate.Text);
                         obj.Cheque_Amount = Convert.ToDecimal(txtChequeAmount.Text);
                     }
                     else
                     {
                         throw new Exception("Fill all cheque enabled fields!");
                     }
                 }
                 else
                 {
                     txtChequeAmount.Text = "0";
                     obj.Cheque_Amount = 0;
                 }
                 obj1.Auction_Type = 1;
                 obj.Payment_Date = Convert.ToDateTime(dateTimePicker1.Text);
                 if (textBox3.Text != "")
                 {
                     obj1.Original_Price = Convert.ToDecimal(textBox3.Text);
                 }
                 else
                 {
                     textBox3.Focus();
                     throw new Exception("Enter Orginal Price!");
                 }
                 obj.Form_id = 9;
                 obj.Register_Date = DateTime.Now;
                 obj.Recipt_No = textBox4.Text;
                 churchDB.Church_AmountDetails.InsertOnSubmit(obj);
                 churchDB.SubmitChanges();
                 long aa = (from a in churchDB.Church_AmountDetails select a.Amount_Id).Max();
                 obj1.FK_Amountid = aa;
                 churchDB.Church_Auction_Details.InsertOnSubmit(obj1);
                 churchDB.SubmitChanges();
                 if (txtChequeAmount.Text == "")
                 {
                     txtChequeAmount.Text = "0";
                 }
                 if (txtCashamount.Text == "")
                 {
                     txtCashamount.Text = "0";
                 }
                 var num = from a in churchDB.Church_AuctionStatus where a.Card_No == Convert.ToInt64(textBox1.Text) select a;
                 if (num.Count() == 0)
                 {
                     Church_AuctionStatus status = new Church_AuctionStatus();
                     status.Card_No = Convert.ToInt64(textBox1.Text);
                     status.Harvest_Total = Convert.ToDecimal(textBox3.Text);
                     status.Harvest_Payed = Convert.ToDecimal(txtCashamount.Text) + Convert.ToDecimal(txtChequeAmount.Text);
                     status.Status = 0;
                     if (status.Harvest_Total == status.Harvest_Payed)
                     {
                         status.Status = 1;
                     }
                     churchDB.Church_AuctionStatus.InsertOnSubmit(status);
                     churchDB.SubmitChanges();
                 }
                 else
                 {
                     var num1 = (from a in churchDB.Church_AuctionStatus where a.Card_No == Convert.ToInt64(textBox1.Text) select a).First();
                     if (num1.Harvest_Total == null && num1.Harvest_Payed == null)
                     {
                         num1.Harvest_Total = 0;
                         num1.Harvest_Payed = 0;
                     }
                     num1.Harvest_Total = num1.Harvest_Total + Convert.ToDecimal(textBox3.Text);
                     num1.Harvest_Payed = num1.Harvest_Payed + Convert.ToDecimal(txtCashamount.Text) + Convert.ToDecimal(txtChequeAmount.Text);
                     num1.Status = 0;
                     if (num1.Harvest_Total == num1.Harvest_Payed)
                     {
                         num1.Status = 1;
                     }
                     churchDB.SubmitChanges();
                 }
                 var amount = (from a in churchDB.Church_OpeningBalanceDetails where a.Account_type == 1 select a).FirstOrDefault();
                 amount.Opening_Bal_Cash = amount.Opening_Bal_Cash + Convert.ToDecimal(txtCashamount.Text) + Convert.ToDecimal(txtChequeAmount.Text);
                 churchDB.SubmitChanges();
                 MessageBox.Show("Submit Successfully");
                 Emptycontrol();
             }
             else
             {
                 throw new Exception("Check any one Cash or Cheque!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext())
                {
                    Church_AmountDetail obj = new Church_AmountDetail();
                    if (textBox1.Text == "")
                    {
                        textBox1.Focus();
                        throw new Exception("Enter the Card No!");
                    }
                    if (checkBox2.Checked)
                    {
                        if (textBox18.Text != txtCashamount.Text)
                        {
                            throw new Exception("Total Amount & cash Amount Not Tally!");
                        }
                        if (textBox18.Text == "")
                        {
                            textBox18.Focus();
                            throw new Exception("Enter the Amount!");
                        }
                        else
                        {
                            obj.Cash_Amount = Convert.ToDecimal(txtCashamount.Text);
                        }
                    }
                    else
                    {
                        obj.Cash_Amount = 0;
                    }
                    if (checkBox1.Checked)
                    {
                        if (textBox18.Text != txtChequeAmount.Text)
                        {
                            throw new Exception("Total Amount & cheque Amount Not Tally!");
                        }
                        if (txtBranch.Text == "" || txtChequeno.Text == "" || txtChequeAmount.Text == "")
                        {
                            throw new Exception("Enter Cheque all Fields!");
                        }
                        else
                        {
                            obj.Bank_Name = Convert.ToInt32(comboBox2.SelectedValue);
                            obj.Branch_Name = txtBranch.Text;
                            obj.Cheque_No = txtChequeno.Text;
                            obj.Cheque_Date = Convert.ToDateTime(ChequeDate.Text);
                            obj.Cheque_Amount = Convert.ToDecimal(txtChequeAmount.Text);
                        }
                    }
                    else
                    {
                        obj.Cheque_Amount = 0;
                    }
                    obj.Card_No = Convert.ToInt64(textBox1.Text);
                    obj.Payment_Date = Convert.ToDateTime(dateTimePicker1.Text);
                    obj.Register_Date = DateTime.Now;
                    obj.Form_id = 1;
                    churchDB.Church_AmountDetails.InsertOnSubmit(obj);
                    churchDB.SubmitChanges();
                    long aa = (from a in churchDB.Church_AmountDetails select a.Amount_Id).Max();
                    Church_SubscriptionDetail subobj = new Church_SubscriptionDetail();
                    subobj.MonthlyOffer = Convert.ToDecimal(textBox2.Text);
                    subobj.Harvest = Convert.ToDecimal(textBox16.Text);
                    subobj.ThanksGiving = Convert.ToDecimal(textBox3.Text);
                    subobj.NewBuildingFund = Convert.ToDecimal(textBox4.Text);
                    subobj.WomensFellowShip = Convert.ToDecimal(textBox5.Text);
                    subobj.MensFellowShip = Convert.ToDecimal(textBox6.Text);
                    subobj.YouthFellowShip = Convert.ToDecimal(textBox7.Text);
                    subobj.SundaySchool = Convert.ToDecimal(textBox8.Text);
                    subobj.EducationFund = Convert.ToDecimal(textBox9.Text);
                    subobj.PoorFund = Convert.ToDecimal(textBox10.Text); ;
                    subobj.I_M_S = Convert.ToDecimal(textBox11.Text);
                    subobj.N_M_S = Convert.ToDecimal(textBox12.Text);
                    subobj.BibleSociety = Convert.ToDecimal(textBox13.Text);
                    subobj.D_B_M = Convert.ToDecimal(textBox14.Text);
                    subobj.Meetings = Convert.ToDecimal(textBox15.Text);
                    subobj.Others = Convert.ToDecimal(textBox17.Text);
                    subobj.FK_AmountId = aa;
                    churchDB.Church_SubscriptionDetails.InsertOnSubmit(subobj);
                    churchDB.SubmitChanges();
                    var cal = (from a in churchDB.Church_AuctionStatus where a.Card_No == Convert.ToInt64(textBox1.Text) select a).FirstOrDefault();
                    if (cal != null)
                    {
                        cal.Harvest_Payed = cal.Harvest_Payed + Convert.ToDecimal(textBox16.Text);
                        if (cal.Harvest_Total == cal.Harvest_Payed)
                        {
                            cal.Status = 1;
                        }
                        churchDB.SubmitChanges();
                    }
                    var amount = (from a in churchDB.Church_OpeningBalanceDetails where a.Account_type == 1 select a).FirstOrDefault();
                    amount.Opening_Bal_Cash = amount.Opening_Bal_Cash + Convert.ToDecimal(textBox2.Text) + Convert.ToDecimal(textBox3.Text) + Convert.ToDecimal(textBox4.Text) + Convert.ToDecimal(textBox8.Text) + Convert.ToDecimal(textBox16.Text);
                    churchDB.SubmitChanges();
                    var mission = (from a in churchDB.Church_OpeningBalanceDetails where a.Account_type == 2 select a).FirstOrDefault();
                    mission.Opening_Bal_Cash = mission.Opening_Bal_Cash + Convert.ToDecimal(textBox6.Text) + Convert.ToDecimal(textBox7.Text) + Convert.ToDecimal(textBox9.Text) + Convert.ToDecimal(textBox10.Text) + Convert.ToDecimal(textBox11.Text) + Convert.ToDecimal(textBox12.Text) + Convert.ToDecimal(textBox13.Text) + Convert.ToDecimal(textBox14.Text) + Convert.ToDecimal(textBox15.Text) + Convert.ToDecimal(textBox17.Text);
                    churchDB.SubmitChanges();
                    MessageBox.Show("Submit Successfully!");
                    Bindingamount();
                    emptyfield();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }