Exemplo n.º 1
0
 private bool save_deal()
 {
     if (id > 0)
     {
         leadsource = new GeneralBLL().GetSingleGeneral(id);
     }
     leadsource.name = this.Name.Text.Trim().ToString();
     if (!string.IsNullOrEmpty(this.Description.Text.Trim()))
     {
         leadsource.remark = this.Description.Text.Trim().ToString();
     }
     if (!string.IsNullOrEmpty(this.Number.Text.Trim().ToString()))
     {
         leadsource.sort_order = Convert.ToDecimal(this.Number.Text.Trim().ToString());
     }
     if (id > 0)
     {
         //修改更新
         if ((leadsource.sort_order != null && sobll.update_sort_order(leadsource.id, leadsource.general_table_id, (Decimal)leadsource.sort_order)) || leadsource.sort_order == null)
         {
             var result = sobll.Update(leadsource, GetLoginUserId());
             if (result == DTO.ERROR_CODE.SUCCESS)
             {
                 Response.Write("<script>alert('商机来源修改成功!');</script>");
                 return(true);
             }
             else if (result == DTO.ERROR_CODE.USER_NOT_FIND)               // 用户丢失
             {
                 Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                 Response.Redirect("../Login.aspx");
             }
             else if (result == DTO.ERROR_CODE.EXIST)
             {
                 Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('已经存在的商机来源中包含该序列号,请修改!');</script>");
         }
     }
     else
     {
         //新增
         leadsource.general_table_id = (int)GeneralTableEnum.OPPORTUNITY_SOURCE;
         if (leadsource.sort_order == null || (leadsource.sort_order != null && sobll.sort_order(leadsource.general_table_id, (Decimal)leadsource.sort_order)))
         {
             var result = sobll.Insert(leadsource, GetLoginUserId());
             if (result == DTO.ERROR_CODE.SUCCESS)
             {
                 Response.Write("<script>alert('商机来源添加成功!');</script>");
                 return(true);
             }
             else if (result == DTO.ERROR_CODE.USER_NOT_FIND)               // 用户丢失
             {
                 Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                 Response.Redirect("../Login.aspx");
             }
             else if (result == DTO.ERROR_CODE.EXIST)
             {
                 Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('已经存在的商机来源中包含该序列号,请修改!');</script>");
         }
     }
     return(false);
 }
Exemplo n.º 2
0
        private bool save_deal()
        {
            if (id > 0)
            {
                stage = new GeneralBLL().GetSingleGeneral(id);
            }
            stage.name = this.Name.Text.Trim().ToString();
            if (!string.IsNullOrEmpty(this.Description.Text.Trim()))
            {
                stage.remark = this.Description.Text.Trim().ToString();
            }
            if (this.Lost.Checked)
            {
                stage.ext1 = "1";
            }
            else
            {
                stage.ext1 = "0";
            }
            if (this.Won.Checked)
            {
                stage.ext2 = "1";
            }
            else
            {
                stage.ext2 = "0";
            }
            if (!string.IsNullOrEmpty(this.Sort_Order.Text.Trim().ToString()))
            {
                stage.sort_order = Convert.ToDecimal(this.Sort_Order.Text.Trim().ToString());
            }
            if (id > 0)
            {
                //修改更新
                if ((stage.sort_order != null && sobll.update_sort_order(stage.id, stage.general_table_id, (Decimal)stage.sort_order)) || stage.sort_order == null)
                {
                    var result = sobll.Update(stage, GetLoginUserId());
                    if (result == DTO.ERROR_CODE.SUCCESS)
                    {
                        Response.Write("<script>alert('商机阶段修改成功!');</script>");
                        return(true);
                    }
                    else if (result == DTO.ERROR_CODE.USER_NOT_FIND)                   // 用户丢失
                    {
                        Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                        Response.Redirect("../Login.aspx");
                    }
                    else if (result == DTO.ERROR_CODE.EXIST)
                    {
                        Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('已经存在的商机阶段中包含该序列号,请修改!');</script>");
                }
            }
            else
            {
                //新增
                stage.general_table_id = (int)GeneralTableEnum.OPPORTUNITY_STAGE;

                if (stage.sort_order == null || (stage.sort_order != null && sobll.sort_order(stage.general_table_id, (Decimal)stage.sort_order)))
                {
                    var result = sobll.Insert(stage, GetLoginUserId());
                    if (result == DTO.ERROR_CODE.SUCCESS)
                    {
                        Response.Write("<script>alert('商机阶段添加成功!');</script>");
                        return(true);
                    }
                    else if (result == DTO.ERROR_CODE.USER_NOT_FIND)               // 用户丢失
                    {
                        Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                        Response.Redirect("../Login.aspx");
                    }
                    else if (result == DTO.ERROR_CODE.EXIST)
                    {
                        Response.Write("<script>alert('已经存在相同名称,请修改!');</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('已经存在的商机阶段中包含该序列号,请修改!');</script>");
                }
            }
            return(false);
        }