private void btnAddData_Click(object sender, EventArgs e) { bool checkvalidate = validation(); string performDate = DateTime.Now.ToString("yyyy-MM-dd"); if (checkvalidate == false) return; DailyAnnaDanamModel dailyAnna = new DailyAnnaDanamModel { Name = txtName.Text, PhoneNumber = txtPhoneNumber.Text, Gothram = txtGothram.Text, VillageName = txtVillageName.Text, DonatedDate = performDate }; var checkIfExists = gothramRepo.checkIfGothramExists(txtGothram.Text); //If Gothra doesn't exist and if user has entered a Gothram if (checkIfExists == null && txtGothram.Text != string.Empty) { string insrtGothra = gothramRepo.insertNewGothraName(txtGothram.Text); } string strInsertStatus = dailyAnnaRepo.insertDonorInformation(dailyAnna); if (strInsertStatus == "Success") { MessageBox.Show("Data inserted successfully."); CleareAllcontrolsRecursive(); loadGothramAutoComplete(); //this.Close(); } }
private void btnAddData_Click(object sender, EventArgs e) { bool checkvalidate = validation(); string performDate = DateTime.Now.ToString("yyyy-MM-dd"); if (checkvalidate == false) return; DailyAnnaDanamModel dailyAnna = new DailyAnnaDanamModel { Name = txtName.Text, PhoneNumber = txtPhoneNumber.Text, Gothram = txtGothram.Text, VillageName = txtVillageName.Text, DonatedDate = performDate }; TokenPrint oTokenPrint = new TokenPrint { Name = txtName.Text, PhoneNumber = txtPhoneNumber.Text, Gothram = txtGothram.Text, VillageName = txtVillageName.Text, DonatedDate = performDate, ServiceType="Nithya Annadanam" }; lstTokenPrint.Add(oTokenPrint); var checkIfExists = gothramRepo.checkIfGothramExists(txtGothram.Text); //If Gothra doesn't exist and if user has entered a Gothram if (checkIfExists == null && txtGothram.Text != string.Empty) { string insrtGothra = gothramRepo.insertNewGothraName(txtGothram.Text); } string strInsertStatus = dailyAnnaRepo.insertDonorInformation(dailyAnna); var bindServiceType = serviceTypeRepo.GetAllAsQuerable(10); List<int> serviceTypeValue = bindServiceType.Select(p => p.Cost).ToList(); string smsMessage = "Thanks " + dailyAnna.Name + " we have recieved an amount of Rs." + serviceTypeValue[0] + "/- towards Daily Annadanam"; if (strInsertStatus == "Success") { MessageBox.Show("Data inserted successfully."); oPrintHelper.PrintTokens(lstTokenPrint, this, _PrinterName, _ShowPrintPreview); CleareAllcontrolsRecursive(); loadGothramAutoComplete(); SMSHelper smsHelp = new SMSHelper(); smsHelp.sendSMS("91" + dailyAnna.PhoneNumber, smsMessage); //this.Close(); } }