/// <summary> /// 页面初始化 /// </summary> protected void PageInit() { IList <EyouSoft.Model.SysStructure.MSysCarTypeSeatNum> seatnumlist = new EyouSoft.BLL.SysStructure.BSysCarType().GetCarTypeSeatNumList(); if (seatnumlist != null && seatnumlist.Count > 0) { this.ddlCarSeatNum.DataTextField = "SeatNum"; this.ddlCarSeatNum.DataValueField = "Id"; this.ddlCarSeatNum.DataSource = seatnumlist; this.ddlCarSeatNum.DataBind(); } if (!string.IsNullOrEmpty(Id)) { EyouSoft.Model.ComStructure.MComCarType model = new EyouSoft.BLL.ComStructure.BComCarType().GetModel(Id); this.txtCarType.Text = model.CarTypeName; this.txtDescribe.Text = model.Desc; this.templateId.Value = model.TemplateId; this.oldseatnum.Value = model.SeatNum.ToString(); IList <EyouSoft.Model.SysStructure.MSysCarTypeSeatNum> list = new EyouSoft.BLL.SysStructure.BSysCarType().GetCarTypeSeatNumList(); if (list != null && list.Count > 0) { foreach (var item in list) { if (item.SeatNum.ToString() == model.SeatNum.ToString()) { this.ddlCarSeatNum.SelectedValue = item.Id.ToString(); } } } } }
/// <summary> /// 删除车型 /// </summary> private void DelCarType() { string cartypeids = Utils.GetQueryStringValue("id"); int i = new EyouSoft.BLL.ComStructure.BComCarType().DelComCarType(cartypeids); if (i == 1) { AjaxResponse(UtilsCommons.AjaxReturnJson("1", "删除成功!")); } else if (i == 2) { AjaxResponse(UtilsCommons.AjaxReturnJson("0", "该车型已被计划使用!")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("0", "删除失败!")); } }
/// <summary> /// 页面初始化 /// </summary> private void PageInit() { //获取分页参数并强转 pageIndex = Utils.GetInt(Utils.GetQueryStringValue("page"), 1); IList <EyouSoft.Model.ComStructure.MComCarType> list = new EyouSoft.BLL.ComStructure.BComCarType().GetList(pageIndex, pageSize, ref recordCount, SiteUserInfo.CompanyId); if (list != null && list.Count > 0) { repList.DataSource = list; repList.DataBind(); //绑定分页 BindPage(); } else { this.ExporPageInfoSelect1.Visible = false; } }
/// <summary> /// 保存 /// </summary> private void Save() { EyouSoft.Model.ComStructure.MComCarType model = new EyouSoft.Model.ComStructure.MComCarType(); model.CarTypeId = Id; model.CarTypeName = Utils.GetFormValue(txtCarType.UniqueID); model.SeatNum = Utils.GetInt(Utils.GetQueryStringValue("ddlCarSeatNum")); model.TemplateId = Utils.GetFormValue(this.templateId.UniqueID); model.Desc = Utils.GetFormValue(txtDescribe.UniqueID); model.CompanyId = CurrentUserCompanyID; model.Operator = SiteUserInfo.Username; model.OperatorId = SiteUserInfo.UserId; if (string.IsNullOrEmpty(Id)) { if (new EyouSoft.BLL.ComStructure.BComCarType().AddComCarType(model)) { AjaxResponse(UtilsCommons.AjaxReturnJson("1", "添加成功!")); } else { AjaxResponse(UtilsCommons.AjaxReturnJson("0", "添加失败!")); } } else { int updatestate = new EyouSoft.BLL.ComStructure.BComCarType().UpdateComCarType(model); switch (updatestate) { case 1: AjaxResponse(UtilsCommons.AjaxReturnJson("1", "修改成功!")); break; case 2: AjaxResponse(UtilsCommons.AjaxReturnJson("0", "该车型已被使用,无法修改!")); break; default: AjaxResponse(UtilsCommons.AjaxReturnJson("0", "修改失败!")); break; } } }
/// <summary> /// 可选车型option /// </summary> /// <param name="busType">选中预设车型</param> /// <returns>select下拉选项</returns> protected string GetPreSetBus(string busType) { string temp = busType.ToString(); StringBuilder sb = new StringBuilder(); IList <EyouSoft.Model.ComStructure.MComCarType> list = new EyouSoft.BLL.ComStructure.BComCarType().GetList(SiteUserInfo.CompanyId); sb.AppendFormat("<option data-num='-' value='' >请选择</option>"); if (list != null && list.Count > 0) { foreach (var item in list) { if (item.CarTypeId == temp) { sb.AppendFormat("<option data-carTypeName='{0}' data-num='{1}' value='{2}' data-desc='{3}' data-temid='{4}' selected='selected'>{0}</option>", item.CarTypeName, item.SeatNum, item.CarTypeId, item.Desc, item.TemplateId); } else { sb.AppendFormat("<option data-carTypeName='{0}' data-num='{1}' value='{2}' data-desc='{3}' data-temid='{4}'>{0}</option>", item.CarTypeName, item.SeatNum, item.CarTypeId, item.Desc, item.TemplateId); } } } return(sb.ToString()); }