Exemplo n.º 1
0
    /// <summary>
    /// 保存修改
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvEdit_Click(object sender, EventArgs e)
    {
        string idList = "";

        try
        {
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);
            if (builder.AutoUpdate())
            {
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "修改", ControlHelper.getControlContent(divDtls, null));
                //JscriptMsg("修改操作成功!", "", "Success");
                JscriptMsg("修改操作成功!", Request.Url.ToString(), "Success");
                //Response.Write("<script language='javascript'>alert('修改操作成功');location.href='" + Request.Url.ToString() + "'</script>");
            }
            else
            {
                JscriptMsg("修改操作失败!", "", "Error");
                // JscriptMsg("修改操作失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// 保存修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSvEdit_Click(object sender, EventArgs e)
 {
     try
     {
         CSA.DAL.SQLBuilder builder = new SQLBuilder();
         builder.TblName = TblName;
         builder.AutoSetInfo(divDtls);
         builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value);
         builder.setModUserInfo(BLL.User.AdminUser.UserID);
         string K_password = this.K_password.Value;
         if (K_password.Length > 0)
         {
             builder.AddData("password", CSA.Security.Encrypt.getMD5(K_password));
         }
         if (builder.AutoUpdate())
         {
             BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                     "修改", ControlHelper.getControlContent(divDtls, null));
             bindData();
             InitField(ControlHelper.CEnum.CANCEL);
             JscriptMsg("修改操作成功!", "", "Success");
         }
         else
         {
             JscriptMsg("修改操作失败!", "", "Error");
         }
     }
     catch (Exception ex)
     {
         JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// 保存新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvAdd_Click(object sender, EventArgs e)
    {
        try
        {
            this.PKID.Value = CSA.Text.Util.getNewGuid();
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.AddData(PKField, this.PKID.Value);
            string casetype = getViewState("casetype");
            if (!string.IsNullOrEmpty(casetype))
            {
                builder.AddData("type", casetype);
            }
            builder.setAddUserInfo(BLL.User.AdminUser.UserID);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);

            if (builder.AutoInsert())
            {
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "添加", ControlHelper.getControlContent(divDtls, null));
                JscriptMsg("添加操作成功", "", "Success");

                Response.Redirect(getLinkWidthBaseParas("BsProducts.aspx", new string[] { "type=del", "casetype=" + getViewState("casetype") }));
            }
            else
            {
                JscriptMsg("添加失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg(ex.Message, "", "Error");
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// 保存新增
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSvAdd_Click(object sender, EventArgs e)
 {
     try
     {
         this.PKID.Value = CSA.Text.Util.getNewGuid();
         CSA.DAL.SQLBuilder builder = new SQLBuilder();
         builder.TblName = TblName;
         builder.AutoSetInfo(divDtls);
         // builder.AddData(PKField, this.PKID.Value);
         builder.setAddUserInfo(BLL.User.AdminUser.UserID);
         builder.setModUserInfo(BLL.User.AdminUser.UserID);
         string K_password = this.K_password.Value;
         if (K_password.Length > 0)
         {
             builder.AddData("password", CSA.Security.Encrypt.getMD5(K_password));
         }
         if (builder.AutoInsert())
         {
             //SendEmailToUser(this.KK_Name.Value, this.K_password.Value,this.KK_Email.Value);
             BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                     "添加", ControlHelper.getControlContent(divDtls, null));
             bindData();
             InitField(ControlHelper.CEnum.CANCEL);
             JscriptMsg("添加操作成功", "", "Success");
         }
         else
         {
             JscriptMsg("添加失败!", "", "Error");
         }
     }
     catch (Exception ex)
     {
         JscriptMsg(ex.Message, "", "Error");
     }
 }
Exemplo n.º 5
0
    /// <summary>
    /// 保存修改
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvEdit_Click(object sender, EventArgs e)
    {
        try
        {
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);

            if (builder.AutoUpdate())
            {
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "修改", ControlHelper.getControlContent(divDtls, null));
                bindData();
                JscriptMsg("修改操作成功!", "", "Success");

                //如果是单篇文章的修改,则修改完不改变当前控件状态
                string pkid = getViewState("pkid");
                if (string.IsNullOrEmpty(pkid))
                {
                    InitField(ControlHelper.CEnum.CANCEL);
                }
            }
            else
            {
                JscriptMsg("修改操作失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
        }
    }
Exemplo n.º 6
0
    /// <summary>
    /// 保存新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvAdd_Click(object sender, EventArgs e)
    {
        try
        {
            this.PKID.Value = CSA.Text.Util.getNewGuid();
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.AddData("pkid", this.PKID.Value);
            builder.AddData("ModUser", BLL.User.AdminUser.UserID);
            builder.AddData("ModTime", DateTime.Now.ToString());
            List <string> lst = new List <string>();
            lst.Add(builder.InsertSql);

            //设置权限
            saveRoleCtrl(ref lst);

            if (DBAccess.ExecuteSqlTran(lst) > 0)
            {
                bindData();
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "添加", ControlHelper.getControlContent(divDtls, null));
                InitField(ControlHelper.CEnum.CANCEL);
                JscriptMsg("添加操作成功", "", "Success");
            }
            else
            {
                JscriptMsg("添加失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg(ex.Message, "", "Error");
        }
    }
Exemplo n.º 7
0
 /// <summary>
 /// 保存新增
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSvAdd_Click(object sender, EventArgs e)
 {
     try
     {
         this.PKID.Value = CSA.Text.Util.getNewGuid();
         CSA.DAL.SQLBuilder builder = new SQLBuilder();
         builder.TblName = TblName;
         builder.AutoSetInfo(divDtls);
         builder.AddData(PKField, this.PKID.Value);
         builder.setAddUserInfo(BLL.User.AdminUser.UserID);
         builder.setModUserInfo(BLL.User.AdminUser.UserID);
         if (builder.AutoInsert())
         {
             BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                     "添加", ControlHelper.getControlContent(divDtls, null));
             JscriptMsg("添加操作成功", "", "Success");
         }
         else
         {
             JscriptMsg("添加失败!", "", "Error");
         }
     }
     catch (Exception ex)
     {
         JscriptMsg(ex.Message, "", "Error");
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 保存修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSvEdit_Click(object sender, EventArgs e)
 {
     try
     {
         CSA.DAL.SQLBuilder builder = new SQLBuilder();
         builder.TblName = TblName;
         builder.AutoSetInfo(divDtls);
         if (this.KK_status.SelectedValue == "0108")
         {
             builder.AddData("isEnd", 1);
         }
         else
         {
             builder.AddData("isEnd", 0);
         }
         builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value);
         builder.setModUserInfo(BLL.User.AdminUser.UserID);
         if (builder.AutoUpdate())
         {
             BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                     "修改", ControlHelper.getControlContent(divDtls, null));
             JscriptMsg("修改操作成功!", "", "Success");
         }
         else
         {
             JscriptMsg("修改操作失败!", "", "Error");
         }
     }
     catch (Exception ex)
     {
         JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
     }
 }
Exemplo n.º 9
0
    protected void btnSvEdit_Click(object sender, EventArgs e)
    {
        try
        {
            SQLBuilder builder = new SQLBuilder(TblName);
            builder.Where = " and 1=1";
            builder.AutoSetInfo(divDtls);
            builder.AddData("moduser", BLL.User.AdminUser.UserID);
            builder.AddData("ModTime", DateTime.Now.ToString("s"));
            if (builder.AutoUpdate())
            {
                bindData();

                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "修改", ControlHelper.getControlContent(divDtls, null));

                JscriptMsg("修改操作成功!", "", "Success");
            }
            else
            {
                JscriptMsg("修改操作失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
        }
    }
Exemplo n.º 10
0
 /// <summary>
 /// 保存修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSvEdit_Click(object sender, EventArgs e)
 {
     try
     {
         CSA.DAL.SQLBuilder builder = new SQLBuilder();
         builder.TblName = TblName;
         builder.AutoSetInfo(divDtls);
         builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value);
         if (KK_Reply.Value.Trim() != "")
         {
             builder.AddData("isReply", "1");
         }
         if (builder.AutoUpdate())
         {
             BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                     "修改", ControlHelper.getControlContent(divDtls, null));
             bindData();
             InitField(ControlHelper.CEnum.CANCEL);
             JscriptMsg("修改操作成功!", "", "Success");
         }
         else
         {
             JscriptMsg("修改操作失败!", "", "Error");
         }
     }
     catch (Exception ex)
     {
         JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
     }
 }
Exemplo n.º 11
0
    /// <summary>
    /// 保存修改
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvEdit_Click(object sender, EventArgs e)
    {
        try
        {
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.Where = " and pkid='" + PKID.Value + "'";
            builder.AddData("ModUser", BLL.User.AdminUser.UserID);
            builder.AddData("ModTime", DateTime.Now.ToString());

            List <string> lst = new List <string>();
            lst.Add(builder.UpdateSql);

            //设置权限
            saveRoleCtrl(ref lst);

            if (DBAccess.ExecuteSqlTran(lst) > 0)
            {
                bindData();
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "修改", ControlHelper.getControlContent(divDtls, null));
                InitField(ControlHelper.CEnum.CANCEL);
                JscriptMsg("修改操作成功!", "", "Success");
            }
            else
            {
                JscriptMsg("修改操作失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
        }
    }
Exemplo n.º 12
0
    /// <summary>
    /// 保存修改
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvEdit_Click(object sender, EventArgs e)
    {
        try
        {
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);
            string pwd = this.Password.Value;
            if (!string.IsNullOrEmpty(pwd))
            {
                builder.AddData("Password", CSA.Security.Encrypt.getMD5(pwd));
            }
            List <string> lst = new List <string>();
            lst.Add(builder.UpdateSql);


            if (DBAccess.ExecuteSqlTran(lst) > 0)
            {
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "修改", ControlHelper.getControlContent(divDtls, null));
                JscriptMsg("修改操作成功!", "", "Success");
            }
            else
            {
                JscriptMsg("修改操作失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
        }
    }
Exemplo n.º 13
0
    /// <summary>
    /// 保存新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvAdd_Click(object sender, EventArgs e)
    {
        try
        {
            this.PKID.Value = CSA.Text.Util.getNewGuid();
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.AddData(PKField, this.PKID.Value);
            builder.AddData("Photos", focus_photo.Value);
            builder.setAddUserInfo(BLL.User.AdminUser.UserID);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);

            List <string> lst = new List <string>();
            lst.Add(builder.InsertSql);

            #region 保存相册==========
            string[] albumArr  = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null && albumArr.Length > 0)
            {
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    if (imgArr.Length == 3)
                    {
                        string remark = "";
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            remark = remarkArr[i];
                        }
                        string sql = string.Format("insert into Bs_NewsAlbums(new_pkid,big_img,small_img,remark,type) values ('{0}','{1}','{2}','{3}','product')", this.PKID.Value, imgArr[1], imgArr[2], remark);
                        lst.Add(sql);
                    }
                }
            }
            #endregion
            if (CSA.DAL.DBAccess.ExecuteSqlTran(lst) > 0)
            {
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "添加", ControlHelper.getControlContent(divDtls, null));
                JscriptMsg("添加操作成功", "", "Success");

                Response.Redirect(getLinkWidthBaseParas("BsProducts.aspx", "type", "del"));
            }
            else
            {
                JscriptMsg("添加失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg(ex.Message, "", "Error");
        }
    }
Exemplo n.º 14
0
    protected void btnAddPro_Click(object sender, EventArgs e)
    {
        SQLBuilder builder = new SQLBuilder("Bs_OrdersDtl");

        builder.DataFlag = "KK2_";
        builder.setAddUserInfo(BLL.User.AdminUser.UserID);
        builder.AutoSetInfo(divProAdd);
        builder.AddData("Bs_OrdersCode", this.PKID.Value);
        if (builder.AutoInsert())
        {
            BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, "Bs_Orders", PKID.Value,
                                    "添加订单产品", ControlHelper.getControlContent(divProAdd, null));
            bindOrderPro();
        }
    }
Exemplo n.º 15
0
    /// <summary>
    /// 保存新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvAdd_Click(object sender, EventArgs e)
    {
        try
        {
            string pid = "";
            string pcode = getViewState("pcode");
            if (pcode != "")
            {
                pid = DBAccess.ExecuteScalar("select pkid from " + TblName + " where code='"
                    + pcode + "'").ToString();
            }

            this.PKID.Value = CSA.Text.Util.getNewGuid();
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);

            builder.AddData("pkid", this.PKID.Value);
            builder.setAddUserInfo(BLL.User.AdminUser.UserID);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);

            if (!string.IsNullOrEmpty(pid))
                builder.AddData("parentID", pid);

            if (builder.AutoInsert())
            {
                bindData();
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                    "添加", ControlHelper.getControlContent(divDtls, null));

                InitField(ControlHelper.CEnum.CANCEL);
                JscriptMsg("添加操作成功", "", "Success");
            }
            else
            {
               JscriptMsg("添加失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg(ex.Message, "", "Error");
        }
    }
Exemplo n.º 16
0
    /// <summary>
    /// 保存新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvAdd_Click(object sender, EventArgs e)
    {
        try
        {
            this.PKID.Value = CSA.Text.Util.getNewGuid();
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.AddData(PKField, this.PKID.Value);
            builder.setAddUserInfo(BLL.User.AdminUser.UserID);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);
            string pwd = this.Password.Value;
            if (!string.IsNullOrEmpty(pwd))
            {
                builder.AddData("Password", CSA.Security.Encrypt.getMD5(pwd));
            }
            List <string> lst = new List <string>();
            lst.Add(builder.InsertSql);

            //设置权限
            saveUserRole(ref lst);

            if (DBAccess.ExecuteSqlTran(lst) > 0)
            {
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "添加", ControlHelper.getControlContent(divDtls, null));
                bindData();
                InitField(ControlHelper.CEnum.CANCEL);
                JscriptMsg("添加操作成功", "", "Success");
            }
            else
            {
                JscriptMsg("添加失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg(ex.Message, "", "Error");
        }
    }
Exemplo n.º 17
0
 /// <summary>
 /// 保存新增
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSvAdd_Click(object sender, EventArgs e)
 {
     try
     {
         this.PKID.Value = CSA.Text.Util.getNewGuid();
         CSA.DAL.SQLBuilder builder = new SQLBuilder();
         builder.TblName = TblName;
         builder.AutoSetInfo(divDtls);
         builder.AddData(PKField, this.PKID.Value);
         builder.setAddUserInfo(BLL.User.AdminUser.UserID);
         builder.setModUserInfo(BLL.User.AdminUser.UserID);
         builder.AddData(FKField, getViewState("pcode"));
         builder.AddData("AddTime", DateTime.Now);
         if (builder.AutoInsert())
         {
             BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                     "添加", ControlHelper.getControlContent(divDtls, null));
             bindData();
             JscriptMsg("添加操作成功", "", "Success");
             //Response.Write(builder.InsertSql);
             //如果是单篇文章的修改,则修改完不改变当前控件状态
             string pkid = getViewState("pkid");
             if (string.IsNullOrEmpty(pkid))
             {
                 InitField(ControlHelper.CEnum.CANCEL);
             }
         }
         else
         {
             JscriptMsg("添加失败!", "", "Error");
         }
     }
     catch (Exception ex)
     {
         JscriptMsg(ex.Message, "", "Error");
     }
 }
Exemplo n.º 18
0
    /// <summary>
    /// 保存新增
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvAdd_Click(object sender, EventArgs e)
    {
        try
        {
            this.PKID.Value = CSA.Text.Util.getNewGuid();
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.AddData(PKField, this.PKID.Value);
            builder.setAddUserInfo(BLL.User.AdminUser.UserID);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);
            builder.AddData("type", "EMAIL");
            if (builder.AutoInsert())
            {
                CSA.Net.Email mail = new CSA.Net.Email();
                mail.Title   = this.KK_Title.Value.Trim();
                mail.Content = this.KK_Content.Value;
                mail.MailTo  = this.KK_Receiver.Value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                mail.Send();

                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "添加", ControlHelper.getControlContent(divDtls, null));
                bindData();
                InitField(ControlHelper.CEnum.CANCEL);
                JscriptMsg("添加操作成功", "", "Success");
            }
            else
            {
                JscriptMsg("添加失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg(ex.Message, "", "Error");
        }
    }
Exemplo n.º 19
0
    /// <summary>
    /// 保存修改
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvEdit_Click(object sender, EventArgs e)
    {
        try
        {
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.Where = " and pkid='" + PKID.Value + "'";

            builder.setModUserInfo(BLL.User.AdminUser.UserID);

            List<string> lst = new List<string>();
            lst.Add(builder.UpdateSql);

            string oldcode = txtCode.Value.Trim();
            string newcode = KK_Code.Value.Trim();
            if (oldcode != newcode)
            {
                //修改下级的Code
                //sqlserver 下的语法
                //string sql = "update sy_menu set code='{0}'+right(code,len(code)-{3})" +
                //        " where code like '{2}%' and len(code)>{3}";

                //sqlite下的语法
                string sql = "update sy_menu set code='{0}'+substr(code,{3}+1)" +
                         " where code like '{2}%' and len(code)>{3}";

                sql = string.Format(sql, newcode, newcode.Length, oldcode, oldcode.Length);
                lst.Add(sql);

                if (newcode.Length == 2)
                {
                    //将本身的ParentID置为null
                    sql = "update sy_menu set parentID=null where pkid='" + PKID.Value + "'";
                    lst.Add(sql);
                }
                else if (newcode.Length > 2)
                {
                    //将本身的ParentID置为新的父ID
                    sql = "update sy_menu set parentID=(select pkid from sy_menu where code='{0}') " +
                        "where pkid='{1}'";
                    sql = string.Format(sql, newcode.Substring(0, newcode.Length - 2), PKID.Value);
                    lst.Add(sql);
                }
                else
                {
                    return;
                }
            }
            if (DBAccess.ExecuteSqlTran(lst) > 0)
            {
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                    "修改", ControlHelper.getControlContent(divDtls, null));
                bindData();
                InitField(ControlHelper.CEnum.CANCEL);
                JscriptMsg("修改操作成功!", "", "Success");
            }
            else
            {
                JscriptMsg("修改操作失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg("修改失败!" + ex.Message.Replace("\r\n",""), "", "Error");
        }
    }
Exemplo n.º 20
0
    /// <summary>
    /// 保存修改
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSvEdit_Click(object sender, EventArgs e)
    {
        string idList = "";

        try
        {
            CSA.DAL.SQLBuilder builder = new SQLBuilder();
            builder.TblName = TblName;
            builder.AutoSetInfo(divDtls);
            builder.AddData("Photos", focus_photo.Value);
            builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value);
            builder.setModUserInfo(BLL.User.AdminUser.UserID);

            List <string> lst = new List <string>();
            lst.Add(builder.UpdateSql);

            #region 保存相册==========
            string[] albumArr  = Request.Form.GetValues("hide_photo_name");
            string[] remarkArr = Request.Form.GetValues("hide_photo_remark");
            if (albumArr != null && albumArr.Length > 0)
            {
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int      img_id = int.Parse(imgArr[0]);
                    idList += img_id + ",";
                    if (imgArr.Length == 3)
                    {
                        string remark = "";
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            remark = remarkArr[i];
                        }
                        //图片id存在---修改  否则 添加
                        if (img_id > 0)
                        {
                            string sql = string.Format("update Bs_NewsAlbums set new_pkid='{0}',big_img='{1}',small_img='{2}',remark='{3}' where id={4}", this.PKID.Value, imgArr[1], imgArr[2], remark, img_id);
                            lst.Add(sql);
                        }
                        else
                        {
                            string sql = string.Format("insert into Bs_NewsAlbums(new_pkid,big_img,small_img,remark,type) values ('{0}','{1}','{2}','{3}','product')", this.PKID.Value, imgArr[1], imgArr[2], remark);
                            lst.Add(sql);
                        }
                    }
                }
            }
            //删除已删除的图片
            new Bs_NewsAlbumsDao().DeleteList(idList, PKID.Value);
            #endregion

            if (CSA.DAL.DBAccess.ExecuteSqlTran(lst) > 0)
            {
                BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value,
                                        "修改", ControlHelper.getControlContent(divDtls, null));
                //JscriptMsg("修改操作成功!", "", "Success");
                Response.Write("<script language='javascript'>alert('修改操作成功');location.href='" + Request.Url.ToString() + "'</script>");
            }
            else
            {
                Response.Write("<script language='javascript'>alert('修改操作失败');location.href='" + Request.Url.ToString() + "'</script>");
                //JscriptMsg("修改操作失败!", "", "Error");
            }
        }
        catch (Exception ex)
        {
            JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error");
        }
    }