private void RefreshForm() { try { //// Sanga Upasthayaka thero //using (BikkuInfo bInfo = new BikkuInfo(true)) //{ // bInfo.BindToComboSangaUpsThero(sangaUpastayakaTheroComboBox); //} //sangaUpastayakaTheroComboBox.SelectedIndex = -1; // Sanga Upasthayaka thero using (District dis = new District(true)) { dis.BindToCombo(districtCombo); } districtCombo.SelectedIndex = -1; UpdateCountry(); } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message, this.Location); } }
private void Login() { try { using (user = new DBCore.Classes.User(true)) { user.UserName = usenameTxt.Text; user.Password = pwdTxt.Text.GetHashCode(); if (user.Login()) { this.DialogResult = DialogResult.OK; this.Close(); } else { MessageView.ShowErrorMsg("Invalied Usename or Password"); } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void setPictureFromFile(string fileName) { try { Image img = Image.FromFile(fileName); // set byte array MemoryStream mem = new MemoryStream(); // picDriverImage.Image.Save(mem, ImageFormat.Png); img.Save(mem, ImageFormat.Jpeg); imageData = mem.ToArray(); if (imageData.Length > 512000) { MessageView.ShowErrorMsg("Image is too large,Maximum size is 500KB"); imageData = null; return; } pictureBox.Image = getThumbImage(img); img.Save("test.jpg", ImageFormat.Jpeg); } catch (Exception ex) { MessageView.ExceptionError(ex); } }
private void AddUpdate() { try { using (MemberInfo memInfo = new MemberInfo(true)) { if (ValidateBeforeAdd(memInfo)) { memInfo.Name = nameTextBoxX.Text; memInfo.Address = addressTextbox.Text; memInfo.Mobile = mobileText.Text; memInfo.HomeTP = homeTpText.Text; memInfo.Email = emailText.Text; memInfo.regNumber = indexText.Text; memInfo.DataVerified = verifiedCheck.Checked ? 1 : 0; memInfo.Amount = (int)amountTxt.Value; memInfo.bank = (DBCore.Banks)bankCombo.SelectedIndex + 1; memInfo.paymentType = (DBCore.PaymentType)paymentTypeCombo.SelectedIndex + 1; memInfo.subscriptionType = (DBCore.SubscriptionType)subscriptionTypeCombo.SelectedIndex + 1; memInfo.nameInMag = nameInmagText.Text; memInfo.numOfMagazine = (int)numOfMag.Value; memInfo.Note = note; addAddressToObject(memInfo); if (memberID == 0) { if (memInfo.Add() == 1) { ShowStatus("Successfully Added"); nextIndex = memInfo.GetNextIndex(); clear(); } } else { memInfo.ID = memberID; if (MessageView.ShowQuestionMsg("Update Member info") == DialogResult.OK) { if (memInfo.Update() == 1) { ShowStatus("Successfully Updated"); clear(); } } } } } // SetIndexField(); } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void addbtn_Click(object sender, EventArgs e) { try { if (ValidateBeforeAdd()) { using (Asapuwa asapuwa = new Asapuwa(true)) { asapuwa.AsapuwaName = nameTextBoxX.Text; asapuwa.ContactNumber1 = tp1textBox.Text; asapuwa.ContactNumber2 = tp2TextBox.Text; asapuwa.Address = addressTextBox.Text; asapuwa.SangaUpasthayakahimi = 0; // sangaUpastayakaTheroComboBox.SelectedValue != null ? (int)sangaUpastayakaTheroComboBox.SelectedValue : 0; asapuwa.OpeningDate = dateOfOpenDtm.Value.Date; asapuwa.HeldUpasampada = false; // upasampadaCheckBox.Checked; asapuwa.District = districtCombo.SelectedValue == null ? 0 : (int)districtCombo.SelectedValue; asapuwa.PostalCode = postalcodeTextbox.Text; asapuwa.Country = countryCombo.SelectedValue == null ? 0 : countryCombo.Text == "ශ්රී ලංකාව" ? 0 : (int)countryCombo.SelectedValue; asapuwa.NumberOfKuti = (int)numberOfKutiTxt.Value; if (asapuwaID == 0) { if (asapuwa.Add() == 1) { MessageView.ShowMsg("Sucessfully Added"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } else { asapuwa.ID = asapuwaID; if (MessageView.ShowQuestionMsg("Update '" + nameTextBoxX.Text + "' Asapuwa") == DialogResult.OK) { if (asapuwa.Update() == 1) { MessageView.ShowMsg("Sucessfully Updated"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } } } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
public void AddSubCategoryBtn(int SubcategoryIndex) { try { } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message, this.Location); } }
private void categoryCombo_SelectedIndexChanged(object sender, EventArgs e) { try { RefreshSubCategory(); } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message, this.Location); } }
private void addbtn_Click(object sender, EventArgs e) { try { if (ValidateBeforeAdd()) { using (OtherAddress addr = new OtherAddress(true)) { setObjectFromFieldValues(addr); if (addressID == 0) { if (addr.Add() == 1) { // MessageView.ShowMsg("Sucessfully Added"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); statusText.Visible = true; timer1.Enabled = true; clear(); } } else { addr.ID = addressID; if (MessageView.ShowQuestionMsg("Update Address") == DialogResult.OK) { if (addr.Update() == 1) { MessageView.ShowMsg("Sucessfully Updated"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } } } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void addbtn_Click(object sender, EventArgs e) { try { if (ValidateBeforeAdd()) { using (Tag tg = new Tag(true)) { tg.Name = nameTextBoxX.Text; tg.Description = descriptionText.Text; if (occuID == 0) { if (tg.Add() == 1) { MessageView.ShowMsg("Sucessfully Added"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } else { tg.ID = occuID; if (MessageView.ShowQuestionMsg("Update School") == DialogResult.OK) { if (tg.Update() == 1) { MessageView.ShowMsg("Sucessfully Updated"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } } } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void addbtn_Click(object sender, EventArgs e) { try { if (ValidateBeforeAdd()) { using (UtilityData ut = new UtilityData(true)) { ut.NameID = NameID; ut.Value = nameTextBoxX.Text; if (ID == 0) { if (ut.Add() == 1) { MessageView.ShowMsg("Sucessfully Added"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } else { ut.ID = ID; if (MessageView.ShowQuestionMsg("Update ") == DialogResult.OK) { if (ut.Update() == 1) { MessageView.ShowMsg("Sucessfully Updated"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } } } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void RefreshForm() { try { using (Category cat = new Category(true)) { cat.BindToCombo(categoryCombo); } categoryCombo.SelectedIndex = -1; } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message, this.Location); } }
private void addbtn_Click(object sender, EventArgs e) { try { if (ValidateBeforeAdd()) { using (EduQualifications edu = new EduQualifications(true)) { edu.Name = nameTextBoxX.Text; if (occuID == 0) { if (edu.Add() == 1) { MessageView.ShowMsg("Sucessfully Added"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } else { edu.ID = occuID; if (MessageView.ShowQuestionMsg("Update EduQualifications") == DialogResult.OK) { if (edu.Update() == 1) { MessageView.ShowMsg("Sucessfully Updated"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } } } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void buttonX2_Click(object sender, EventArgs e) { try { frmCategory frmCat = new frmCategory(); frmCat.currentCategories = (DataTable)categoryCombo.DataSource; frmCat.ShowFromAdd(new CallbackAdd(AddCategoryBtn)); using (Category cat = new Category(true)) { cat.BindToCombo(categoryCombo); } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message, this.Location); } }
private void buttonX1_Click(object sender, EventArgs e) { try { frmSubCategory subCat = new frmSubCategory(); subCat.currentCategories = (DataTable)subcategoryCombo.DataSource; subCat.mainCatSelectedIndex = categoryCombo.SelectedIndex; subCat.ShowFromAdd(new CallbackAdd(AddSubCategoryBtn)); RefreshSubCategory(); } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message, this.Location); } }
private void RefreshSubCategory() { try { subcategoryCombo.Text = string.Empty; if (categoryCombo.SelectedValue != null && categoryCombo.SelectedValue is int) { using (Category cat = new Category(true)) { cat.mainCategoryID = (int)categoryCombo.SelectedValue; cat.BindToCombo_sub(subcategoryCombo); } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message, this.Location); } }
private void addbtn_Click(object sender, EventArgs e) { try { using (BikkuInfo bInfo = new BikkuInfo(true)) { if (ValidateBeforeAdd(bInfo)) { bInfo.NIC = nicTextBoxX.Text; bInfo.SamaneraNumber = samaneraNumberTextBoxX.Text; bInfo.PassportNumber = passportNumbrtTextBoxX.Text; bInfo.PlaceOfBirth = placeOfBirthtxt.Text; bInfo.LayNameInFull = layNameinFullTxt.Text; bInfo.DateOfBirth = dobDtm.Value.Date; bInfo.NameOfFatherInFull = nameOfFatheinFullTxt.Text; bInfo.DateOfRobing = dateOfRobingDtm.Value.Date; bInfo.NameAssumedAtRobing = nameOfAssumedAtRobinTxt.Text; bInfo.NameOfRobingTutor = nameOfRobingTutorCombo.SelectedValue == null ? 0 : (int)nameOfRobingTutorCombo.SelectedValue; bInfo.TempleRobing = templaRobingTookCombo.SelectedValue == null ? 0 : (int)templaRobingTookCombo.SelectedValue; bInfo.TempleOfResidence = templaResidenceCombo.SelectedValue == null ? 0 : (int)templaResidenceCombo.SelectedValue; bInfo.NameOfViharadhipathi = nameOfViharadhipathiCombo.SelectedValue == null ? 0 : (int)nameOfViharadhipathiCombo.SelectedValue; bInfo.IsUpasampanna = isUpasampannaCheckBox.Checked; bInfo.PlaceOfHigherOrdination = upasampannaPlaceComboBoxEx.SelectedValue == null ? 0 : (int)upasampannaPlaceComboBoxEx.SelectedValue; bInfo.DateOfHigherOrdination = upasampannaDatetp.Value.Date; bInfo.NameOfUpadyaAtHigherOrdination = nameofUpadyaComboBoxEx.SelectedValue == null ? 0 : (int)nameofUpadyaComboBoxEx.SelectedValue; bInfo.IsUpadyaThero = isUpadyaCheckBox.Checked; //bInfo.Post = isSangaUpasCheckBox.Checked; bInfo.District = districtcomboBox.SelectedValue == null ? 0 : (int)districtcomboBox.SelectedValue; bInfo.DateOfCame = dateofCameDtm.Value; // == new DateTime() bInfo.HomeAddress = homeaddressText.Text; bInfo.HomeTP = hometpText.Text; if (bloodGroupCombo.SelectedItem != null) { ComboItem item = (ComboItem)bloodGroupCombo.SelectedItem; bInfo.BloodGroup = item.Text; } if (bikkuImage == null) { bInfo.ImageData = string.Empty; } else { bInfo.ImageData = Utility.Get64String(bikkuImage); } if (bhikkuID == 0) { setActivitiesToObject(bInfo); setAsapuHistryToObject(bInfo); setOtherDataToObject(bInfo); if (bInfo.Add() == 1) { MessageView.ShowMsg("Sucessfully Added"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } else { bInfo.ID = bhikkuID; if (MessageView.ShowQuestionMsg("Update Current Item") == DialogResult.OK) { // if templae changed, ask for add record to histry if (TempleOfResidenceBeforeChange != bInfo.TempleOfResidence) { string message = string.Concat("<br/><br/><b>Asapuwa : </b>", TempleOfResidenceBeforeChangeName, "\r\n<br/><b>From Date : </b>", histryDatagrid.Rows[histryDatagrid.RowCount - 1].Cells[4].Value, "\r\n<br/><b>To Date : </b>", DateTime.Now.ToString("yyyy-MMM-dd")); if (MessageView.ShowQuestionMsg("Residence temple has edited, Add histry record? \n\n" + message) == System.Windows.Forms.DialogResult.OK) { } } if (bInfo.Update() == 1) { MessageView.ShowMsg("Sucessfully Updated"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } } } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void addbtn_Click(object sender, EventArgs e) { try { if (ValidateBeforeAdd()) { if (paymentID == 0 && monthlyAmount > 0) { int numberofMonths = (int)amountText.Value / monthlyAmount; for (int i = 0; i < numberofMonths; i++) { using (MonthlyPayment pay = new MonthlyPayment(true)) { setObjectFromFieldValues(pay, i); if (pay.MemberID > 0 && pay.Add() == 1) { // MessageView.ShowMsg("Sucessfully Added"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); statusText.Visible = true; timer1.Enabled = true; extraAmountNum.Value = 0; } } } clear(1); } else if (memberID > 0) { using (MonthlyPayment pay = new MonthlyPayment(true)) { pay.ID = paymentID; setObjectFromFieldValues(pay, 0); if (MessageView.ShowQuestionMsg("Update record") == DialogResult.OK) { if (pay.Update() == 1) { SetHistryGrid(pay.GetPaymentHistry()); extraAmountNum.Value = 0; } } } } } } // catch() catch (Exception ex) { if (ex.Message.StartsWith("Duplicate entry")) { MessageView.ShowErrorMsg("Already Added"); } else { MessageView.ShowErrorMsg(ex.Message); } } }
private void addbtn_Click(object sender, EventArgs e) { try { using (MemberInfo memInfo = new MemberInfo(true, memberType)) { if (ValidateBeforeAdd(memInfo)) { memInfo.NIC = nicText.Text; memInfo.BloodGroup = bloodGroupCombo.Text; memInfo.Name = nameTextBoxX.Text; memInfo.Address = addressTextbox.Text; memInfo.DOB = dobDate.Value.Date; memInfo.Mobile = mobileText.Text; memInfo.HomeTP = homeTpText.Text; memInfo.Email = emailText.Text; memInfo.Occupatition = occuCombo.SelectedValue == null ? -1 : (int)occuCombo.SelectedValue; memInfo.OccupatitioInfo = occuText.Text; memInfo.DOJoinAsapuwa = dojoindate.Value.Date; memInfo.Abilities = abilityText.Text; memInfo.Contributition = contribText.Text; memInfo.IndexNumber = indexText.Text; memInfo.School = schoolCombo.SelectedValue == null ? -1 : (int)schoolCombo.SelectedValue; memInfo.EduQualifications = eduQuaCombo.SelectedValue == null ? -1 : (int)eduQuaCombo.SelectedValue; memInfo.OtherQualifications = otheQualiText.Text; memInfo.DataVerified = verifiedCheck.Checked ? 1 : 0; if (bloodGroupCombo.SelectedItem != null) { ComboItem item = (ComboItem)bloodGroupCombo.SelectedItem; memInfo.BloodGroup = item.Text; } memInfo.Sex = sexCombo.SelectedIndex; memInfo.CivilStatus = civilStatusCombo.SelectedIndex; if (imageData == null) { memInfo.ImageData = string.Empty; } else { memInfo.ImageData = Utility.Get64String(imageData); } if (memberID == 0) { addTagsToObject(memInfo); if (memInfo.Add() == 1) { MessageView.ShowMsg("Sucessfully Added"); nextIndex = memInfo.GetNextIndex(); clear(); } } else { memInfo.ID = memberID; if (MessageView.ShowQuestionMsg("Update Member info") == DialogResult.OK) { if (memInfo.Update() == 1) { MessageView.ShowMsg("Sucessfully Updated"); //errorProvider1.SetError(idTxt, string.Empty); //errorProvider1.SetError(nameTxt, string.Empty); clear(); } } } } } // SetIndexField(); } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void RefreshForm() { try { // recidence using (Asapuwa asapuwa = new Asapuwa(true)) { asapuwa.BindToCombo(templaResidenceCombo); asapuwa.BindToCombo(asapuHistrAsapu); } templaResidenceCombo.SelectedIndex = -1; asapuHistrAsapu.SelectedIndex = -1; // robing using (Asapuwa asapuwa = new Asapuwa(true)) { asapuwa.BindToComboHeldUpasampada(templaRobingTookCombo); } templaRobingTookCombo.SelectedIndex = -1; // upasampanna using (Asapuwa asapuwa = new Asapuwa(true)) { asapuwa.BindToComboHeldUpasampada(upasampannaPlaceComboBoxEx); } upasampannaPlaceComboBoxEx.SelectedIndex = -1; // Upadya thero using (BikkuInfo bInfo = new BikkuInfo(true)) { bInfo.BindToComboUpadyaThero(nameofUpadyaComboBoxEx); } nameofUpadyaComboBoxEx.SelectedIndex = -1; // Tutor thero using (BikkuInfo bInfo = new BikkuInfo(true)) { bInfo.BindToComboUpadyaThero(nameOfRobingTutorCombo); } nameOfRobingTutorCombo.SelectedIndex = -1; // viharadhipathi thero using (BikkuInfo bInfo = new BikkuInfo(true)) { bInfo.BindToComboUpadyaThero(nameOfViharadhipathiCombo); } nameOfViharadhipathiCombo.SelectedIndex = -1; // District thero using (District dis = new District(true)) { dis.BindToCombo(districtcomboBox); } districtcomboBox.SelectedIndex = -1; } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message, this.Location); } }
public ChangeListItemBhikku(string text, Panel panel, BikkuInfo bInfo, int width, AddDeleteChangeItem addChangeItemTable, System.Windows.Forms.ToolTip _requestAsapuTooltip, string _requestedAsapuNames) { try { this.bInfo = bInfo; RequestAsapuTooltip = _requestAsapuTooltip; RequestedAsapuNames = _requestedAsapuNames; AddChangeItemTable = addChangeItemTable; this.Size = new System.Drawing.Size(width + 80, 68); this.Location = new System.Drawing.Point(5, (panel.Controls.Count * this.Height) + (panel.Controls.Count * 2) + 20); this.Font = new System.Drawing.Font(this.Font.FontFamily, 13, FontStyle.Bold); //this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.ContextMenu = CreateContextMenuItems(); InitializeComponent(); this.BodyButton.MouseEnter += new EventHandler(ChangeListLabel_MouseEnter); this.BodyButton.MouseLeave += new EventHandler(ChangeListLabel_MouseLeave); this.BodyButton.MouseDown += new MouseEventHandler(label_MouseDown); this.HeadButton.MouseEnter += new EventHandler(ChangeListLabel_MouseEnter); this.HeadButton.MouseLeave += new EventHandler(ChangeListLabel_MouseLeave); this.HeadButton.MouseDown += new MouseEventHandler(label_MouseDown); this.RearButton.MouseEnter += new EventHandler(ChangeListLabel_MouseEnter); this.RearButton.MouseLeave += new EventHandler(ChangeListLabel_MouseLeave); this.RearButton.MouseDown += new MouseEventHandler(label_MouseDown); if (string.IsNullOrEmpty(bInfo.ImageData)) { imagePicbox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; } else { imagePicbox.BorderStyle = System.Windows.Forms.BorderStyle.None; Utility.setBhikkuPictureFromByteArray(DBCore.Utility.GetByteFrom64String(bInfo.ImageData), imagePicbox); } setOriginalImage(bInfo.BhikkuType, bInfo.ChangeType, false, isDraged); this.Controls.Add(imagePicbox); this.Controls.Add(BodyButton); this.Controls.Add(HeadButton); this.Controls.Add(RearButton); HeadButton.Location = new Point(0, 20); imagePicbox.Location = new Point(30, 0); BodyButton.Location = new Point(98, 20); BodyButton.Size = new System.Drawing.Size(this.Width - HeadButton.Width - RearButton.Width - imagePicbox.Width + 3, 30); RearButton.Location = new Point(98 + BodyButton.Width, 20); RearButton.BringToFront(); BodyButton.Text = text; if (!string.IsNullOrEmpty(RequestedAsapuNames)) { BodyButton.ForeColor = Color.FromArgb(0, 0, 80); } AddObjectTopanel(panel, this); toolTipParent = this.Parent.Parent.Parent.Parent.Parent.Parent; } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }
private void addbtn_Click(object sender, EventArgs e) { try { if (ValidateBeforeAdd()) { using (Item item = new Item(true)) { item.Name = nameTxt.Text; item.Code = idTxt.Text; item.Cost = (double)costNud.Value; item.Price = (double)priceNUD.Value; item.InStock = (int)inStockNUD.Value; item.WarnLimit = (int)warnLimitNUD.Value; item.MainCategory = (int)categoryCombo.SelectedValue; item.SubCategory = subcategoryCombo.SelectedValue == null ? 0 : (int)subcategoryCombo.SelectedValue; item.CustomPrice = customPriceCheckbox.Checked; if (itemID == 0) { int status = item.SelectExists(); switch (status) { case 0: if (item.Add() == 1) { MessageView.ShowMsg("Sucessfully Added"); errorProvider1.SetError(idTxt, string.Empty); errorProvider1.SetError(nameTxt, string.Empty); clear(); } break; case 1: errorProvider1.SetError(idTxt, "'Item Code' Already Exists"); break; case 2: errorProvider1.SetError(nameTxt, "'Name' Already Exists"); break; case 3: errorProvider1.SetError(nameTxt, "'Name' Already Exists"); errorProvider1.SetError(idTxt, "'Item Code' Already Exists"); break; } } else { item.ID = itemID; if (MessageView.ShowQuestionMsg("Update Current Item") == DialogResult.OK) { if (item.Update() == 1) { MessageView.ShowMsg("Sucessfully Updated"); errorProvider1.SetError(idTxt, string.Empty); errorProvider1.SetError(nameTxt, string.Empty); clear(); } } } } } } catch (Exception ex) { MessageView.ShowErrorMsg(ex.Message); } }