Esempio n. 1
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();
        }
Esempio n. 2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string lasttime = "";

            if (txtTitle.Text == "")
            {
                this.divAlert.Visible = true;
                lblAlert.Text         = "请输入反馈标题!";
                CloseDivImplementation(); // 关闭等待框
                return;
            }
            else if (txtMessage.Text == "")
            {
                this.divAlert.Visible = true;
                lblAlert.Text         = "请输入反馈内容!";
                CloseDivImplementation(); // 关闭等待框
                return;
            }
            //foreach (FeedbackEO feedBackEOLast in feedBackMO.GetTopSort("Fb_state =0 and Fb_del = 0 and Fb_addUser='******'", 1, "Fb_addTime desc"))
            foreach (FeedbackEO feedBackEOLast in feedBackMO.GetTopSort("Fb_state =0 and Fb_del = 0 and Fb_addUser=@GetUserID", 1, "Fb_addTime desc", GetUserID()))
            {
                lasttime = feedBackEOLast.FbAddTime.ToString();
            }

            if (lasttime != "")
            {
                TimeSpan timespan = new TimeSpan(0, 1, 0);
                if (DateTime.Now - Convert.ToDateTime(lasttime) < timespan)
                {
                    this.divAlert.Visible = true;
                    lblAlert.Text         = "亲,您操作过于频繁,请1分钟后尝试!";
                    CloseDivImplementation(); // 关闭等待框
                    return;
                }
            }
            this.divAlert.Visible = false;
            FeedbackEO feedBackEO = new FeedbackEO();

            feedBackEO.FbTitle       = txtTitle.Text;
            feedBackEO.FbDescription = txtMessage.Text;
            UpFile upfile  = new UpFile();
            string a       = "";
            string ImgName = upfile.UpLoadImage(FileUpload1, GetBigGuid(), this.Page, out a, "../File/FeedBackFile/");

            feedBackEO.FbUrl     = ImgName;
            feedBackEO.FbDel     = "0";
            feedBackEO.FbState   = "0";
            feedBackEO.PfId      = ddlPf.Text;
            feedBackEO.FbAddUser = GetUserID();
            feedBackEO.FbAddTime = DateTime.Now;

            if (feedBackMO.Add(feedBackEO) > 0)
            {
                InsertLog("问题反馈", GetDisPlayName(feedBackEO), -2, GetPlatformIdByValue(1)); //  添加日志
                Jswork.AlertAndRedirect("问题提交成功,我们会尽快处理!", "FeedBackList.aspx", this.Page);
            }
            else
            {
                Jswork.AlertAndRedirect("问题提交声失败,请与管理员联系!", "FeedBackList.aspx", this.Page);
            }
            CloseDivImplementation();
        }