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();
        }
Esempio n. 2
0
        /// <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();
        }