private void textBox1_Leave(object sender, EventArgs e) { try { Validationfieldnum(textBox1); using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { if (textBox1.Text != string.Empty) { var name = (from a in obj.Church_MemberDetails where a.CardNo == Convert.ToInt64(textBox1.Text) select a).SingleOrDefault(); if (name != null) { label8.Text = name.MemberName; label7.Text = Convert.ToString(name.Mobile); string[] Address = name.Address.Split(','); label11.Text = Address[0] + ","; label12.Text = Address[1] + "."; } else { label2.Text = "It's not valid Card No!"; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void AccountDetail_Load(object sender, EventArgs e) { // int a=Convert.ToInt32( txtCashamount.Text); textBox1.Text = "0"; textBox2.Text = "0"; textBox3.Text = "0"; textBox4.Text = "0"; textBox5.Text = "0"; textBox6.Text = "0"; textBox7.Text = "0"; textBox8.Text = "0"; textBox9.Text = "0"; checkBox2.Checked = true; txtCashamount.Enabled = false; txtBranch.Enabled = false; txtChequeAmount.Enabled = false; txtChequeno.Enabled = false; ChequeDate.Enabled = false; comboBox2.Enabled = false; // comboBox1.Text = "Gentral"; using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { comboBox3.DataSource = from a in obj.Church_OfferingDetails select a; comboBox3.DisplayMember = "Offername"; comboBox3.ValueMember = "Offering_id"; comboBox2.DataSource = from a in obj.Church_BankDetails select a; comboBox2.DisplayMember = "Bank_name"; comboBox2.ValueMember = "Bank_id"; } }
private void button2_Click(object sender, EventArgs e) { using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { if (textBox2.Text != string.Empty) { var single = from a in obj.Church_GeneralExpenditureType_Details where a.Expenditure_Name == "Others" select a; obj.Church_GeneralExpenditureType_Details.DeleteOnSubmit(single.SingleOrDefault()); obj.SubmitChanges(); Church_GeneralExpenditureType_Detail church = new Church_GeneralExpenditureType_Detail(); church.Expenditure_Name = textBox2.Text; obj.Church_GeneralExpenditureType_Details.InsertOnSubmit(church); obj.SubmitChanges(); Church_GeneralExpenditureType_Detail church1 = new Church_GeneralExpenditureType_Detail(); church1.Expenditure_Name = "Others"; obj.Church_GeneralExpenditureType_Details.InsertOnSubmit(church1); obj.SubmitChanges(); comboBox1.DataSource = from a in obj.Church_GeneralExpenditureType_Details select a; comboBox1.DisplayMember = "Expenditure_Name"; comboBox1.ValueMember = "Expenditure_id"; textBox2.Text = string.Empty; MessageBox.Show("Added Successfully!"); } else { MessageBox.Show("Enter Expenditure Name!"); } } }
private void button1_Click(object sender, EventArgs e) { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var varify = from a in churchDB.Church_LoginDetails where (a.Login_name==Convert.ToString(txtusername.Text)&&a.Password==Convert.ToString(txtpwd.Text)&&a.Login_type==Convert.ToInt32(comboBox1.SelectedIndex)) select a; if(varify.Count()==1) { menu obj = new menu(comboBox1.SelectedIndex); // menu obj = new menu(); obj.ShowDialog(); emptyfield(); } else { MessageBox.Show("enter valid UserName & Password"); } } //if (txtusername.Text == "admin" && txtpwd.Text == "admin") //{ // menu obj = new menu(comboBox1.SelectedIndex); // // menu obj = new menu(); // obj.ShowDialog(); // emptyfield(); //} //else //{ // MessageBox.Show("enter valid UserName & Password"); //} }
private void Income_and_Expenditure_Mission_Load(object sender, EventArgs e) { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var amount = (from a in churchDB.Church_OpeningBalanceDetails where a.Account_type == 2 select a).FirstOrDefault(); label1.Text = Convert.ToString(amount.Opening_Bal_Cash); label4.Text = Convert.ToString(amount.Opening_Bal_Account); } }
private void Bindingamount() { using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { var Bal = (from a in obj.Church_AuctionStatus where a.Card_No == Convert.ToInt64(textBox1.Text) select a).First(); label14.Text = Convert.ToString(Bal.Sunday_Action_Total - Bal.Sunday_Action_Payed); } }
private void GeneralAccountBankDeposit_Load(object sender, EventArgs e) { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var amount = (from a in churchDB.Church_OpeningBalanceDetails where a.Account_type == 1 select a).FirstOrDefault(); label15.Text = Convert.ToString(amount.Opening_Bal_Cash); label16.Text = Convert.ToString(amount.Opening_Bal_Account); } }
private void button1_Click(object sender, EventArgs e) { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var all = churchDB.sp_Church_WomensFollowShip(Convert.ToDateTime(dateTimePicker1.Text), Convert.ToDateTime(dateTimePicker2.Text)); foreach (var item in all) { label19.Text = Convert.ToString(item.WomensFellowShip); } } }
private void SundayAuction_Load(object sender, EventArgs e) { checkBox2.Checked = true; comboBox2.Enabled = false; txtBranch.Enabled = false; txtChequeno.Enabled = false; ChequeDate.Enabled = false; txtChequeAmount.Enabled = false; using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { comboBox2.DataSource = from a in obj.Church_BankDetails select a; comboBox2.DisplayMember = "Bank_name"; comboBox2.ValueMember = "Bank_id"; } }
private void btnLogin_Click(object sender, EventArgs e) { int logintype = 1; using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var varify = from a in churchDB.Church_LoginDetails where (a.Login_type == logintype && a.Login_name == txtaccountnamager.Text && a.Password == txtPassword.Text) select a; if (varify.Count() == 1) { this.Close(); GeneralOffering accdetail = new GeneralOffering(); accdetail.ShowDialog(); } else { MessageBox.Show("Enter valid Username&Password!!!"); } } }
private void button1_Click(object sender, EventArgs e) { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var all = churchDB.sp_Church_CriditMissionAccount(Convert.ToDateTime(dateTimePicker2.Text), Convert.ToDateTime(dateTimePicker3.Text)); foreach (var item in all) { label20.Text = Convert.ToString(item.MensFellowShip); label21.Text = Convert.ToString(item.YouthFellowShip); label23.Text = Convert.ToString(item.EducationFund); label26.Text = Convert.ToString(item.PoorFund); label27.Text = Convert.ToString(item.I_M_S); label28.Text = Convert.ToString(item.N_M_S); label29.Text = Convert.ToString(item.BibleSociety); label30.Text = Convert.ToString(item.D_B_M); label31.Text = Convert.ToString(item.Meetings); label32.Text = Convert.ToString(item.Others); } } }
private void ExpenditureMissionAccount_Load(object sender, EventArgs e) { checkBox2.Checked = true; comboBox2.Enabled = false; txtBranch.Enabled = false; txtChequeno.Enabled = false; ChequeDate.Enabled = false; txtChequeAmount.Enabled = false; using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { comboBox2.DataSource = from a in obj.Church_BankDetails select a; comboBox2.DisplayMember = "Bank_name"; comboBox2.ValueMember = "Bank_id"; comboBox1.DataSource = from a in obj.Church_MissionExpenditureType_Details select a; comboBox1.DisplayMember = "MissionExpenditure_Name"; comboBox1.ValueMember = "MissionExprnditure_Id"; } comboBox2.Text = "THE LAKSHMI VILAS BANK LTD"; txtBranch.Text = "Kovaipudur"; }
private void btnresetpwd_Click(object sender, EventArgs e) { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var varify = from a in churchDB.Church_LoginDetails where (a.Password == txtOldpwd.Text && a.Login_type == comboBox1.SelectedIndex) select a; if (varify.Count() == 1) { if (txtNewpwd.Text == txtRenewpwd.Text) { if (System.Windows.Forms.MessageBox.Show("Do you want to Change?", "Conformation", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Asterisk, System.Windows.Forms.MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.OK) { var updatelist = (varify).SingleOrDefault(); updatelist.Password = txtRenewpwd.Text; churchDB.SubmitChanges(); MessageBox.Show("Reset Successfully!"); this.Close(); } } else { txtRenewpwd.Text = string.Empty; MessageBox.Show("Re_enter the new password!!!"); } } else { txtOldpwd.Text = string.Empty; txtNewpwd.Text = string.Empty; txtRenewpwd.Text = string.Empty; MessageBox.Show("Check the old password!!!"); } } }
private void button1_Click(object sender, EventArgs e) { try { Validationfieldnumamount(textBox2); if (textBox2.Text=="") { throw new Exception("Enter Amount!"); } if (Convert.ToDecimal(textBox2.Text)>Convert.ToDecimal(label15.Text)) { throw new Exception("Enter valid Amount!"); } using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { 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); amount.Opening_Bal_Account = amount.Opening_Bal_Account + Convert.ToDecimal(textBox2.Text); label15.Text=Convert.ToString(amount.Opening_Bal_Cash); label16.Text = Convert.ToString(amount.Opening_Bal_Account); churchDB.SubmitChanges(); Church_Deposit_Detail obj = new Church_Deposit_Detail(); obj.Payment_Date = Convert.ToDateTime(dateTimePicker1.Text); obj.Amount = Convert.ToDecimal(textBox2.Text); obj.Register_Date = DateTime.Now; obj.Account_type = 1; churchDB.Church_Deposit_Details.InsertOnSubmit(obj); churchDB.SubmitChanges(); MessageBox.Show("Deposit Successfully!"); emptyfield(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { try { using (ChurchApplicationDataContext chruchDB = new ChurchApplicationDataContext()) { Church_ExpenditureAmount_Detail obj = new Church_ExpenditureAmount_Detail(); if (comboBox1.Text != "Others") { if (checkBox2.Checked) { if (txtCashamount.Text != string.Empty) { Validationfieldnum(txtCashamount); obj.Cash_Amount = Convert.ToDecimal(txtCashamount.Text); } else { throw new Exception("Enter Cash Amount!"); } } else { txtCashamount.Text = "0"; obj.Cash_Amount = 0; } if (checkBox1.Checked) { if (txtChequeAmount.Text != string.Empty && txtBranch.Text != string.Empty && txtChequeno.Text != string.Empty) { Validationfieldnum(txtChequeAmount); obj.Cheque_Amount = Convert.ToDecimal(txtChequeAmount.Text); obj.Bank_Name = Convert.ToInt32(comboBox2.SelectedValue); obj.Branch_Name = txtBranch.Text; obj.Cheque_No = txtChequeno.Text; obj.Cheque_Date = Convert.ToDateTime(ChequeDate.Text); } else { throw new Exception("Enter Cheque Enabled Fields!"); } } else { txtChequeAmount.Text = "0"; obj.Cheque_Amount = 0; } obj.Towards = textBox1.Text; obj.Payment_Date = Convert.ToDateTime(dateTimePicker1.Text); obj.MissionExpenditureType = Convert.ToInt32(comboBox1.SelectedValue); obj.Formid = 6; obj.Register_Date = DateTime.Now; chruchDB.Church_ExpenditureAmount_Details.InsertOnSubmit(obj); chruchDB.SubmitChanges(); var amount = (from a in chruchDB.Church_OpeningBalanceDetails where a.Account_type == 2 select a).FirstOrDefault(); if (txtCashamount.Text != "0") { amount.Opening_Bal_Cash = amount.Opening_Bal_Cash - Convert.ToDecimal(txtCashamount.Text); chruchDB.SubmitChanges(); } else { amount.Opening_Bal_Account = amount.Opening_Bal_Account - Convert.ToDecimal(txtChequeAmount.Text); chruchDB.SubmitChanges(); } MessageBox.Show("Submit Successfully!"); emptyfield(); } else { textBox2.Focus(); throw new Exception("Enter Expenditure Type!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Bindingamount() { using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { var Bal = (from a in obj.Church_AuctionStatus where a.Card_No == Convert.ToInt64(textBox1.Text) select a).SingleOrDefault(); if (Bal != null) { label30.Text = Convert.ToString(Bal.Harvest_Total - Bal.Harvest_Payed); } else { label30.Text = "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); } }
private void SubscriptionCard_Load(object sender, EventArgs e) { comboBox2.Enabled = false; txtBranch.Enabled = false; txtChequeno.Enabled = false; ChequeDate.Enabled = false; checkBox2.Checked = true; txtCashamount.Enabled = false; txtChequeAmount.Enabled = false; textBox2.Text = "0"; textBox16.Text = "0"; textBox3.Text = "0"; textBox4.Text = "0"; textBox5.Text = "0"; textBox6.Text = "0"; textBox7.Text = "0"; textBox8.Text = "0"; textBox9.Text = "0"; textBox10.Text = "0"; textBox11.Text = "0"; textBox12.Text = "0"; textBox13.Text = "0"; textBox14.Text = "0"; textBox15.Text = "0"; textBox17.Text = "0"; using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { comboBox2.DataSource = from a in obj.Church_BankDetails select a; comboBox2.DisplayMember = "Bank_name"; comboBox2.ValueMember = "Bank_id"; comboBox1.DataSource = from a in obj.Church_MemberDetails select a; comboBox1.DisplayMember = "MemberName"; comboBox1.ValueMember = "MemberId"; } }
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); } }
private void comboBox1_TextUpdate(object sender, EventArgs e) { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { //MessageBox.Show(comboBox1.Text); var name = churchDB.Church_MemberDetails.Where(a => a.MemberName.Contains(comboBox1.Text)); //churchDB.sp_Church_NameSearch(comboBox1.Text); comboBox1.DataSource = name; } ////SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=ChurchApplication;Integrated Security=True"); ////con.Open(); ////SqlCommand cmd = new SqlCommand("sp_Church_NameSearch", con); ////cmd.CommandType = CommandType.StoredProcedure; ////cmd.Parameters.AddWithValue("@name", Convert.ToString(comboBox1.Text)); ////SqlDataAdapter da = new SqlDataAdapter(cmd); ////DataSet ds = new DataSet(); ////da.Fill(ds); ////con.Close(); ////comboBox1.DataSource = ds.Tables[0]; ////comboBox1.DisplayMember = Convert.ToString(ds.Tables[0].Rows[0]["name"]); ////comboBox1.ValueMember = Convert.ToString(ds.Tables[0].Rows[0]["id"]); }
private void button6_Click(object sender, EventArgs e) { dataGridView2.Visible = true; using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { DateTime dt = Convert.ToDateTime(dateTimePicker1.Text); DateTime dt1 = Convert.ToDateTime(dateTimePicker2.Text); var member = from a in churchDB.Church_MemberDetails where a.MaritalStatus == "Married" && a.Gender == "Male" && a.MarriageDate.Value.Day >= dt.Day && a.MarriageDate.Value.Day <= dt1.Day && a.MarriageDate.Value.Month >= dt.Month && a.MarriageDate.Value.Month <= dt1.Month select a; // var member = churchDB.sp_Church_MemberDetailMarriagedatepick(Convert.ToDateTime(dateTimePicker1.Text), Convert.ToDateTime(dateTimePicker2.Text)); dataGridView2.DataSource = member; //dataGridView1.datab } }
private void button2_Click(object sender, EventArgs e) { try { Validationfieldtext(txtName); Validationfieldnum(txtTelephone); Validationfieldnum(txtMobile); Validationfieldtext(txtOccupation); if (txtName.Text != string.Empty && txtFamilyno.Text != string.Empty && txtAddress.Text != string.Empty && txtMobile.Text != string.Empty && txtOccupation.Text != string.Empty) { if (txtMobile.TextLength == 10) { String marital = "Unmarried"; if (cbMarried.Checked) { marital = "Married"; } using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { Church_MemberDetail obj = new Church_MemberDetail(); obj.MemberName = txtName.Text; if (txtCardno.Text == "") { obj.CardNo = null; } else { obj.CardNo = Convert.ToInt64(txtCardno.Text); } obj.FamilyNo = Convert.ToInt32(txtFamilyno.Text); obj.Address = Convert.ToString(txtAddress.Text); obj.Gender = Convert.ToString(comboBox1.Text); if (txtTelephone.Text == "") { obj.Telephone = null; } else { obj.Telephone = Convert.ToString(txtTelephone.Text); } obj.Mobile = Convert.ToInt64(txtMobile.Text); obj.Occupation = txtOccupation.Text; obj.DOB = Convert.ToDateTime(dateTimePickerDOB.Text); obj.MaritalStatus = marital; obj.RegisterDate = DateTime.Now; if (marital == "Married") { obj.MarriageDate = Convert.ToDateTime(dateTimePickerMarriage.Text); } else { obj.MarriageDate = null; } churchDB.Church_MemberDetails.InsertOnSubmit(obj); churchDB.SubmitChanges(); Cardno(); emptyfield(); // dataGridView1.Refresh(); } } else { MessageBox.Show("enter valid mobile no!"); } } else { label14.Visible = true; label15.Visible = true; label16.Visible = true; label17.Visible = true; label18.Visible = true; MessageBox.Show("Fill the mandatory fields *"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//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); } }
private void Cardno() { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var number = from a in churchDB.Church_MemberDetails select a; if (number.Count() == 0) { txtCardno.Text = Convert.ToString(1); } else { long max_value = Convert.ToInt64((from a in churchDB.Church_MemberDetails select a.CardNo).Max()); txtCardno.Text = Convert.ToString(max_value + 1); } var nonadult = from b in churchDB.Church_MemberDetails where b.CardNo == null select b; lbCount.Text = Convert.ToString("(" + nonadult.Count() + ")"); } }
private void Familyno() { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { string max_value = (from a in churchDB.Church_MemberDetails select a.FamilyNo).Max().ToString(); txtFamilyno.Text = max_value; } }
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); } }
private void button1_Click(object sender, EventArgs e) { using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { var all = churchDB.sp_Church_CriditMissionAccount(Convert.ToDateTime(dateTimePicker2.Text), Convert.ToDateTime(dateTimePicker3.Text)); foreach (var item in all) { label20.Text = Convert.ToString(item.MensFellowShip); label21.Text = Convert.ToString(item.YouthFellowShip); label23.Text = Convert.ToString(item.EducationFund); label26.Text = Convert.ToString(item.PoorFund); label6.Text = Convert.ToString(item.I_M_S); label5.Text = Convert.ToString(item.N_M_S); label29.Text = Convert.ToString(item.BibleSociety); label30.Text = Convert.ToString(item.D_B_M); label31.Text = Convert.ToString(item.Meetings); label32.Text = Convert.ToString(item.Others); } Validationfieldnum(label20); Validationfieldnum(label21); Validationfieldnum(label23); Validationfieldnum(label26); Validationfieldnum(label6); Validationfieldnum(label5); Validationfieldnum(label29); Validationfieldnum(label30); Validationfieldnum(label31); Validationfieldnum(label32); label40.Text = Convert.ToString(Convert.ToDecimal(label20.Text) + Convert.ToDecimal(label21.Text) + Convert.ToDecimal(label23.Text) + Convert.ToDecimal(label26.Text) + Convert.ToDecimal(label6.Text) + Convert.ToDecimal(label5.Text) + Convert.ToDecimal(label29.Text) + Convert.ToDecimal(label30.Text) + Convert.ToDecimal(label31.Text) + Convert.ToDecimal(label32.Text)); } SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=ChurchApplication;Integrated Security=True"); con.Open(); SqlCommand cmd = new SqlCommand("sp_Church_Mission_Expenditure", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@fromdate", Convert.ToDateTime(dateTimePicker2.Text)); cmd.Parameters.AddWithValue("@todate", Convert.ToDateTime(dateTimePicker3.Text)); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); con.Close(); label64.Text = Convert.ToString(ds.Tables[0].Rows[0]["Mens_Cash"]); label52.Text = Convert.ToString(ds.Tables[0].Rows[0]["Mens_Cheque"]); label63.Text = Convert.ToString(ds.Tables[1].Rows[0]["Youth_Cash"]); label51.Text = Convert.ToString(ds.Tables[1].Rows[0]["Youth_Cheque"]); label62.Text = Convert.ToString(ds.Tables[2].Rows[0]["Edu_Cash"]); label50.Text = Convert.ToString(ds.Tables[2].Rows[0]["Edu_Cheque"]); label61.Text = Convert.ToString(ds.Tables[3].Rows[0]["Poor_Cash"]); label49.Text = Convert.ToString(ds.Tables[3].Rows[0]["Poor_Cheque"]); label60.Text = Convert.ToString(ds.Tables[4].Rows[0]["IMS_Cash"]); label48.Text = Convert.ToString(ds.Tables[4].Rows[0]["IMS_Cheque"]); label59.Text = Convert.ToString(ds.Tables[5].Rows[0]["NMS_Cash"]); label47.Text = Convert.ToString(ds.Tables[5].Rows[0]["NMS_Cheque"]); label58.Text = Convert.ToString(ds.Tables[6].Rows[0]["Bible_Cash"]); label46.Text = Convert.ToString(ds.Tables[6].Rows[0]["Bible_Cheque"]); label57.Text = Convert.ToString(ds.Tables[7].Rows[0]["DBM_Cash"]); label45.Text = Convert.ToString(ds.Tables[7].Rows[0]["DBM_Cheque"]); label56.Text = Convert.ToString(ds.Tables[8].Rows[0]["Meeting_Cash"]); label44.Text = Convert.ToString(ds.Tables[8].Rows[0]["Meeting_Cheque"]); label55.Text = Convert.ToString(ds.Tables[9].Rows[0]["Miscellaneous_Cash"]); label43.Text = Convert.ToString(ds.Tables[9].Rows[0]["Miscellaneous_Cheque"]); Validationfieldnum(label64); Validationfieldnum(label52); Validationfieldnum(label63); Validationfieldnum(label51); Validationfieldnum(label62); Validationfieldnum(label50); Validationfieldnum(label61); Validationfieldnum(label49); Validationfieldnum(label60); Validationfieldnum(label48); Validationfieldnum(label59); Validationfieldnum(label47); Validationfieldnum(label58); Validationfieldnum(label46); Validationfieldnum(label57); Validationfieldnum(label45); Validationfieldnum(label56); Validationfieldnum(label44); Validationfieldnum(label55); Validationfieldnum(label43); label41.Text = Convert.ToString(Convert.ToDecimal(label64.Text) + Convert.ToDecimal(label52.Text) + Convert.ToDecimal(label63.Text) + Convert.ToDecimal(label51.Text) + Convert.ToDecimal(label62.Text) + Convert.ToDecimal(label50.Text) + Convert.ToDecimal(label61.Text) + Convert.ToDecimal(label49.Text) + Convert.ToDecimal(label60.Text) + Convert.ToDecimal(label48.Text) + Convert.ToDecimal(label59.Text) + Convert.ToDecimal(label47.Text) + Convert.ToDecimal(label58.Text) + Convert.ToDecimal(label46.Text) + Convert.ToDecimal(label57.Text) + Convert.ToDecimal(label45.Text) + Convert.ToDecimal(label56.Text) + Convert.ToDecimal(label44.Text) + Convert.ToDecimal(label55.Text) + Convert.ToDecimal(label43.Text)); }
//private void comboBox1_KeyDown(object sender, KeyEventArgs e) //{ // using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) // { // var name = churchDB.sp_Church_NameSearch(comboBox1.Text); // comboBox1.DataSource = name; // foreach (var item in name) // { // comboBox1.DisplayMember = item.MemberName; // comboBox1.ValueMember = Convert.ToString(item.MemberId); // } // } // SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=ChurchApplication;Integrated Security=True"); // con.Open(); // SqlCommand cmd = new SqlCommand("sp_Church_NameSearch", con); // cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.AddWithValue("@name", Convert.ToString(comboBox1.Text)); // SqlDataAdapter da = new SqlDataAdapter(cmd); // DataSet ds = new DataSet(); // da.Fill(ds); // con.Close(); // comboBox1.DataSource = ds.Tables[0]; // comboBox1.DisplayMember = Convert.ToString(ds.Tables[0].Rows[0]["name"]); // //comboBox2.ValueMember = Convert.ToString(ds.Tables[0].Rows[0]["id"]); //} private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { using (ChurchApplicationDataContext obj = new ChurchApplicationDataContext()) { try { if (comboBox1.SelectedIndex != -1) { Int64 ff = 0; try { ff = Convert.ToInt64(comboBox1.SelectedValue); var name = (from a in obj.Church_MemberDetails where a.MemberId == ff select a).FirstOrDefault(); if (name != null) { textBox1.Text = Convert.ToString(name.CardNo); label2.Text = name.MemberName; label3.Text = Convert.ToString(name.Mobile); string[] Address = name.Address.Split(','); label26.Text = Address[0] + ","; label27.Text = Address[1] + "."; } else { label31.Text = "It's not valid Card No!"; } } catch (Exception) { return; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void button5_Click(object sender, EventArgs e) { dataGridView2.Visible = true; using (ChurchApplicationDataContext churchDB = new ChurchApplicationDataContext()) { // DateTimeConverter obj = new DateTimeConverter(); // label19.Text = dateTimePicker1.Text; DateTime dt = Convert.ToDateTime(dateTimePicker1.Text); DateTime dt1 = Convert.ToDateTime(dateTimePicker2.Text); var member = from a in churchDB.Church_MemberDetails where a.DOB.Value.Day >= dt.Day && a.DOB.Value.Day <= dt1.Day && a.DOB.Value.Month >= dt.Month && a.DOB.Value.Month <= dt1.Month select a; dataGridView2.DataSource = member; //dataGridView1.datab } }
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); } }