protected void btnOK_Click(object sender, EventArgs e) { AgencyPolicy agent; if (txtHiddenId.Text == "-1") { agent = new AgencyPolicy(); } else { agent = Module.AgencyPolicyGetById(Convert.ToInt32(txtHiddenId.Text)); } Role role = Module.RoleGetById(Convert.ToInt32(Request.QueryString["RoleId"])); agent.Role = role; agent.CostFrom = Convert.ToDouble(txtFrom.Text); double db; if (Double.TryParse(txtTo.Text, out db)) { agent.CostTo = db; } else { agent.CostTo = null; } agent.Percentage = Convert.ToDouble(txtPercentage.Text); agent.IsPercentage = ddlUnit.SelectedIndex == 0; if (string.IsNullOrEmpty(Request.QueryString["ModuleType"])) { agent.ModuleType = "HOTEL"; } else { agent.ModuleType = Request.QueryString["ModuleType"].ToUpper(); } if (agent.Id > 0) { Module.Update(agent); } else { Module.Save(agent); } GetDataSource(role); rptPrices.DataBind(); programmaticModalPopup.Hide(); }
protected void btnOK_Click(object sender, EventArgs e) { try { AgencyPolicy agent; if (txtHiddenId.Text == "-1") { agent = new AgencyPolicy(); } else { agent = Module.AgencyPolicyGetById(Convert.ToInt32(txtHiddenId.Text)); } Role role = Module.RoleGetById(Convert.ToInt32(Request.QueryString["RoleId"])); agent.Role = role; agent.CostFrom = Convert.ToDouble(txtFrom.Text); double db; if (Double.TryParse(txtTo.Text, out db)) { agent.CostTo = db; } else { agent.CostTo = null; } agent.Percentage = Convert.ToDouble(txtPercentage.Text); agent.IsPercentage = ddlUnit.SelectedIndex == 0; agent.ModuleType = "ORIENTALSAILS"; if (agent.Id > 0) { Module.Update(agent); } else { Module.Save(agent); } GetDataSource(role); rptPrices.DataBind(); programmaticModalPopup.Hide(); } catch (Exception ex) { _logger.Error("Error when btnOK_Click in AgenPriceList", ex); ShowError(ex.Message); } }
protected void rptPrices_DataBound(object sender, RepeaterItemEventArgs e) { AgencyPolicy agent = e.Item.DataItem as AgencyPolicy; if (agent != null) { using (Label lbl = e.Item.FindControl("lblCostTo") as Label) { if (lbl != null) { if (agent.CostTo.HasValue) { lbl.Text = ((AgencyPolicy)e.Item.DataItem).CostTo.Value.ToString(); } else { lbl.Text = Resources.textAndUp; } } } using (Label lblApply = e.Item.FindControl("lblApply") as Label) { if (lblApply != null) { if (agent.IsPercentage) { lblApply.Text = string.Format("{0}%", ((AgencyPolicy)e.Item.DataItem).Percentage); } else { lblApply.Text = string.Format("+{0}$", ((AgencyPolicy)e.Item.DataItem).Percentage); } } } } }
/// <summary> /// Xóa thông tin loại đại lý /// </summary> /// <param name="agency">loại đại lý cần xóa</param> public void Delete(AgencyPolicy agency) { _commonDao.DeleteObject(agency); }
/// <summary> /// Cập nhật thông tin loại đại lý /// </summary> /// <param name="agency">loại đại lý cần lưu</param> public void Update(AgencyPolicy agency) { _commonDao.UpdateObject(agency); }
/// <summary> /// Lưu thông tin loại đại lý /// </summary> /// <param name="agency">loại đại lý cần lưu</param> public void Save(AgencyPolicy agency) { _commonDao.SaveObject(agency); }