/// <summary> /// 加载平台信息 /// </summary> private void LoadPlatform() { NxPlatformEO NxPlatformEO = new NxPlatformEO(); NxPlatformEO = PfManage.GetPlatformByPK(Request.QueryString["Pfid"]); if (!string.IsNullOrEmpty(NxPlatformEO.PfName)) { this.txtPfname.Text = NxPlatformEO.PfName; txtPfname_en.Text = NxPlatformEO.PfText1;//显示英文名称 this.hfPfName.Value = NxPlatformEO.PfName; this.hfPfImg.Value = NxPlatformEO.PfImgUrl; this.imgUrl.ImageUrl = NxPlatformEO.PfImgUrl; if (!string.IsNullOrEmpty(NxPlatformEO.PfImgUrl)) { this.imgUrl.ImageUrl = NxPlatformEO.PfImgUrl; this.imgUrl.Visible = true; this.FileUpload1.Visible = false; this.btnUpload.Visible = true; this.btnCancelUpload.Visible = false; } else { this.imgUrl.Visible = false; this.FileUpload1.Visible = true; this.btnUpload.Visible = false; this.btnCancelUpload.Visible = true; } this.rblState.SelectedValue = NxPlatformEO.PfState; this.txtPfsort.Text = NxPlatformEO.PfSort.ToString(); } }
public void ProcessRequest(HttpContext context) { NxPlatformMO NxPlatformMO = new NxPlatformMO("LZBgAuthorityConn"); string id = context.Request["id"].ToString(); string message = ""; if (id != "") { NxPlatformEO NxPlatformEO = NxPlatformMO.GetByPK(id); if (NxPlatformEO.PfNewEndTime == null) { NxPlatformEO.PfNewEndTime = new DateTime(1970, 1, 1); } if (NxPlatformEO.PfNewEndTime < DateTime.Now) { NxPlatformMO.PutPfIsNewShowByPK(id, "0"); // 将信息修改为不显示 message = "0"; } else { message = NxPlatformEO.PfIsNewShow + NxPlatformEO.PfNewFunction; } } context.Response.ContentType = "text/plain"; context.Response.Write(message); }
protected void btnOK_Click(object sender, EventArgs e) { NxPlatformEO NxPlatformEO = new NxPlatformEO(); NxPlatformEO = PfManage.GetPlatformByPK(this.ddlPf.SelectedValue); if (this.rblStatus.SelectedValue == "0") { NxPlatformEO.PfIsRepair = "1"; //开启维护 NxPlatformEO.PfIsNewShow = "0"; //不显示新功能说明 } else { NxPlatformEO.PfIsNewShow = "1"; //显示新功能 NxPlatformEO.PfIsRepair = "0"; //关闭维护 if (string.IsNullOrEmpty(this.txtPfnewFunction.Text.Trim())) { this.divAlert.Visible = true; this.lblAlert.Text = "请输入新功能说明"; this.txtPfnewFunction.Focus(); CloseDivImplementation(); return; } else { NxPlatformEO.PfNewFunction = this.txtPfnewFunction.Text.Trim(); } if (string.IsNullOrEmpty(this.txtEndTime.Text.Trim())) { this.divAlert.Visible = true; this.lblAlert.Text = "请选择维护结束时间"; CloseDivImplementation(); return; } else { NxPlatformEO.PfNewEndTime = Convert.ToDateTime(txtEndTime.Text.Trim()); } } if (PfManage.EditPlatform(NxPlatformEO) > 0) { //插入操作日志 InsertLog("修改平台维护信息", string.Format("Platformname:{0},id:{1}", this.ddlPf.SelectedItem.Text, this.ddlPf.SelectedValue), 14, GetPlatformIdByValue(1)); CloseDivImplementation(); Jswork.Alert("平台维护信息修改成功", "PlatformMaintain.aspx"); } else { this.divAlert.Visible = true; this.lblAlert.Text = "平台维护信息修改失败"; } CloseDivImplementation(); }
/// <summary> /// 更新数据 /// </summary> /// <param name = "item">要更新的实体对象</param> /// <param name="tm">事务管理对象</param> /// <return>受影响的行数</return> public virtual int UpdatePlatform(NxPlatformEO item, TransactionManager tm = null) { const string sql = @"UPDATE platform SET Pf_name=@Pf_name, Pf_imgWaterUrl = @Pf_imgWaterUrl, Pf_imgUrl=@Pf_imgUrl, Pf_addUser=@Pf_addUser, Pf_addTime=@Pf_addTime, Pf_state=@Pf_state, Pf_del=@Pf_del, Pf_sort=@Pf_sort, Pf_text1=@Pf_text1, Pf_text2=@Pf_text2,Pf_isRepair=@Pf_isRepair,Pf_newFunction=@Pf_newFunction,Pf_newEndTime=@Pf_newEndTime,Pf_isNewShow=@Pf_isNewShow WHERE Pf_id=@Pf_id"; return(Database.CreateSqlDao(sql) .AddInParameter("@Pf_id", item.PfId, DbType.String, 50) .AddInParameter("@Pf_name", item.PfName != null ? (object)item.PfName : DBNull.Value, DbType.String, 50) .AddInParameter("@Pf_imgWaterUrl", item.PfImgWaterUrl != null ? (object)item.PfImgWaterUrl : DBNull.Value, DbType.String, 200) .AddInParameter("@Pf_imgUrl", item.PfImgUrl != null ? (object)item.PfImgUrl : DBNull.Value, DbType.String, 200) .AddInParameter("@Pf_addUser", item.PfAddUser != null ? (object)item.PfAddUser : DBNull.Value, DbType.String, 50) .AddInParameter("@Pf_addTime", item.PfAddTime, DbType.DateTime, 8) .AddInParameter("@Pf_state", item.PfState, DbType.AnsiStringFixedLength, 1) .AddInParameter("@Pf_del", item.PfDel, DbType.AnsiStringFixedLength, 1) .AddInParameter("@Pf_sort", item.PfSort.HasValue ? (object)item.PfSort.Value : DBNull.Value, DbType.Int32, 4) .AddInParameter("@Pf_text1", item.PfText1 != null ? (object)item.PfText1 : DBNull.Value, DbType.String, 100) .AddInParameter("@Pf_text2", item.PfText2 != null ? (object)item.PfText2 : DBNull.Value, DbType.String, 100) .AddInParameter("@Pf_isRepair", item.PfIsRepair, DbType.AnsiStringFixedLength, 1) .AddInParameter("@Pf_newFunction", item.PfNewFunction != null ? (object)item.PfNewFunction : DBNull.Value, DbType.String, -1) .AddInParameter("@Pf_newEndTime", item.PfNewEndTime, DbType.DateTime, 8) .AddInParameter("@Pf_isNewShow", item.PfIsNewShow, DbType.AnsiStringFixedLength, 1) .ExecNonQuery(tm)); }
/// <summary> /// 新增、修改信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { if (this.CheckForm() == false) { CloseDivImplementation(); return; } if (this.hfPfImg.Value == "" && this.FileUpload1.HasFile == false) { this.divAlert.Visible = true; this.lblAlert.Text = Resources.Resource.Please_upload_platform;//"请上传平台图片"; } NxPlatformEO NxPlatformEO = new NxPlatformEO(); if (Request.QueryString["State"] == "U") { NxPlatformEO = PfManage.GetPlatformByPK(Request.QueryString["Pfid"]); } NxPlatformEO.PfName = this.txtPfname.Text.Trim(); NxPlatformEO.PfText1 = this.txtPfname_en.Text.Trim();//平台的英文名称 NxPlatformEO.PfState = this.rblState.SelectedValue; if (Regex.IsMatch(this.txtPfsort.Text.Trim(), "^[0-9]*$")) { NxPlatformEO.PfSort = Convert.ToInt32(this.txtPfsort.Text.Trim()); } else { this.divAlert.Visible = true; this.lblAlert.Text = Resources.Resource.Platform_ordering_must_be_numeric;//"平台排序必须为数字"; CloseDivImplementation(); return; } //创建平台信息 if (Request.QueryString["State"] == "A") { //判断平台名称是否存在 if (this.CheckPlatformName() == false) { //Jswork.Alert("平台名称 " + this.txtPfname.Text.Trim() + " 已存在", this.Page); this.divAlert.Visible = true; this.lblAlert.Text = Resources.Resource.Platfor_mname + this.txtPfname.Text.Trim() + Resources.Resource.Already_exist; CloseDivImplementation(); return; } NxPlatformEO.PfId = GetBigGuid(); string ImgName = GetBigGuid(); string waterImgName = ""; if (this.FileUpload1.HasFile) { ImgName = upFile.UpLoadImage(FileUpload1, ImgName, this.Page, out waterImgName, "../Images/Platform/"); } else { waterImgName = "noimg.jpg"; ImgName = "noimg.jpg"; } NxPlatformEO.PfImgUrl = "../Images/Platform/" + ImgName; NxPlatformEO.PfDel = "0"; NxPlatformEO.PfAddUser = GetUserID(); NxPlatformEO.PfAddTime = DateTime.Now; NxPlatformEO.PfNewEndTime = DateTime.Now; NxPlatformEO.PfImgWaterUrl = "../Images/Platform/" + ImgName; if (PfManage.AddPlatform(NxPlatformEO) > 0) { //插入操作日志 InsertLog(Resources.Resource.Create_platform_information, string.Format("Platformname:{0},id:{1}", NxPlatformEO.PfName, NxPlatformEO.PfId), 13, GetPlatformIdByValue(1)); CloseDivImplementation(); Jswork.Alert(Resources.Resource.Platform_information_to_create_success, "PlatformList.aspx"); } else { //Jswork.Alert("平台信息创建失败", this.Page); this.divAlert.Visible = true; this.lblAlert.Text = Resources.Resource.Platform_information_creation_failed; //"平台信息创建失败"; } } //修改平台信息 if (Request.QueryString["State"] == "U") { //修改时判断平台名称是否存在 if (this.hfPfName.Value != this.txtPfname.Text.Trim()) { //判断平台名称是否存在 if (this.CheckPlatformName() == false) { //Jswork.Alert("平台名称 " + this.txtPfname.Text.Trim() + " 已存在", this.Page); this.divAlert.Visible = true; this.lblAlert.Text = Resources.Resource.Platfor_mname + this.txtPfname.Text.Trim() + Resources.Resource.Already_exist; CloseDivImplementation(); return; } } if (this.FileUpload1.Visible == true && this.FileUpload1.HasFile) { string waterImgName = ""; string ImgName = GetBigGuid(); ImgName = upFile.UpLoadImage(FileUpload1, ImgName, this.Page, out waterImgName, "../Images/Platform/"); NxPlatformEO.PfImgWaterUrl = "../Images/Platform/" + waterImgName; NxPlatformEO.PfImgUrl = "../Images/Platform/" + ImgName; } if (PfManage.EditPlatform(NxPlatformEO) > 0) { //插入操作日志 InsertLog(Resources.Resource.Modify_platform_information, string.Format("Platformname:{0},id:{1}", NxPlatformEO.PfName, NxPlatformEO.PfId), 14, GetPlatformIdByValue(1)); CloseDivImplementation(); Jswork.Alert(Resources.Resource.Successful_platform_information_modification, "PlatformList.aspx"); } else { this.divAlert.Visible = true; this.lblAlert.Text = Resources.Resource.Platform_information_modification_failed;//"平台信息修改失败"; } } CloseDivImplementation(); }
/// <summary> /// 修改平台信息 /// </summary> /// <param name="item"></param> /// <returns></returns> public int EditPlatform(NxPlatformEO item) { return(NxPlatformMO.UpdatePlatform(item)); }
/// <summary> /// 创建平台信息 /// </summary> /// <param name="item"></param> /// <returns></returns> public int AddPlatform(NxPlatformEO item) { return(NxPlatformMO.Add(item)); }