private void btn_save_Click(object sender, EventArgs e) { ValidateInput(); FuelType type = new FuelType(); type.Id = int.Parse(lbl_id.Text.Trim()); type.FuelShortName = txt_code.Text.Trim().ToUpper(); type.FuelFullName = txt_name.Text.Trim(); type.UnitPrice = txt_price.Value; type.GroupOfCompanyID = 1; type.ModifiedUser = commonFunctions.LoginuserID; type.ModifiedDate = DateTime.Now; type.CreatedUser = commonFunctions.LoginuserID; type.CreatedDate = DateTime.Now; type.DataTransfer = 1; if (CheckExistingRepository.CheckForExistingFuelType(txt_name.Text.Trim().ToUpper())) { if (MessageBox.Show("Do you want to update this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { repo.Update(type); GetData(); } } else { if (MessageBox.Show("Do you want to insert this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { repo.Save(type); GetData(); } } }
private void btn_save_Click(object sender, EventArgs e) { ValidateInput(); SalesType type = new SalesType(); type.Id = int.Parse(lbl_id.Text.Trim()); type.Code = txt_code.Text.Trim().ToUpper(); type.Name = txt_des.Text.Trim(); if (CheckExistingRepository.CheckForExistingSalesType(txt_code.Text.Trim().ToUpper())) { if (MessageBox.Show("Do you want to update this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { repo.Update(type); GetData(); } } else { if (MessageBox.Show("Do you want to insert this record?", Messaging.MessageCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { repo.Save(type); GetData(); } } }