private void btnSave_Click(object sender, EventArgs e) { if (ePublicVariable.eVariable.IsFieldEmpty(pnlBody)) { oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.ALL_FIELDS_ARE_REQUIRED.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); return; } else { oMPolicy = new Model.Policy(); oPolicy = new DataAccess.Policy(); oMPolicy.DUE_INTEREST = txtDueRate.Text; oMPolicy.LOST_DAMAGE_INTEREST = txtLDRate.Text; oMPolicy.DAYS_LIMIT = txtMaxDays.Text; oMPolicy.BOOK_LIMIT = txtMaxBooks.Text; if (!oPolicy.IsPolicyExist()) { oPolicy.InsertPolicy(oMPolicy); } else { oPolicy.UpdatePolicy(oMPolicy); } oFrmMsgBox = new frmMessageBox(eVariable.TransactionMessage.RECORD_HAS_BEEN_SUCESSFULLY_SAVED.ToString().Replace("_", " ")); oFrmMsgBox.m_MessageType = frmMessageBox.MESSAGE_TYPE.INFO; oFrmMsgBox.ShowDialog(); } }
public PolicyQueryByOne(Model.Policy policy) { bool success = policy != null; Message message = success ? Message.SuccessGeneral : Message.NoFound; base.ActionResponse = new ActionResponse(message, success); this.Policy = policy; }
public void UpdatePolicy(Model.Policy oData) { try { osb.ConnectionString = sConnectionString; ddq = new DatabaseQuery.DBQuery(); ddq.ConnectionString = osb.ConnectionString; ddq.CommandText = "UPDATE TBL_POLICY SET DUE_PENALTY = '" + oData.DUE_INTEREST + "',LOST_DAMAGE_INTEREST = '" + oData.LOST_DAMAGE_INTEREST + "',DAYS_LIMIT = '" + oData.DAYS_LIMIT + "',BOOK_LIMIT = '" + oData.BOOK_LIMIT + "'"; ddq.ExecuteNonQuery(CommandType.Text); } catch (Exception ex) { throw ex; } }
public void InsertPolicy(Model.Policy oData) { try { osb.ConnectionString = sConnectionString; ddq = new DatabaseQuery.DBQuery(); ddq.ConnectionString = osb.ConnectionString; ddq.CommandText = "INSERT INTO TBL_POLICY (DUE_PENALTY,LOST_DAMAGE_INTERST,DAYS_LIMIT,BOOK_LIMIT) VALUES ('" + oData.DUE_INTEREST + "','" + oData.LOST_DAMAGE_INTEREST + "','" + oData.DAYS_LIMIT + "','" + oData.BOOK_LIMIT + "'"; ddq.ExecuteNonQuery(CommandType.Text); } catch (Exception ex) { throw ex; } }
protected void SubmitButton_Click(object sender, EventArgs e) { Model.Affiliate affiliate = new Model.Affiliate { Id = Convert.ToInt32(affiliateDropDown.SelectedItem.Value) }; Model.Agent agent = new Model.Agent { Id = Convert.ToInt32(agentDropDown.SelectedItem.Value) }; Model.RiskPackage riskPackage = new Model.RiskPackage { Id = Convert.ToInt32(riskPackageDropDown.SelectedItem.Value) }; Model.Insured insured = new Model.Insured { Id = Convert.ToInt32(insuredDropDown.SelectedItem.Value) }; Model.Vehicle vehicle = new Model.Vehicle { RegisterNumber = registerNumberDropDown.SelectedItem.Value }; Model.Policy policy = new Model.Policy { CreatedOn = DateTime.Now, StartDate = Convert.ToDateTime(startDateTextBox.Value), EndDate = Convert.ToDateTime(expireDateTextBox.Value), Affiliate = affiliate, Agent = agent, Insured = insured, Premium = Convert.ToDecimal(premiumTextBox.Text), RiskPackage = riskPackage, Vehicle = vehicle }; policyDao.InsertPolicy(policy); Response.Redirect("~/Pages/Policy/Policies.aspx"); }