Exemple #1
0
        protected void save_close_Click(object sender, EventArgs e)
        {
            d_general pageDic = AssembleModel <d_general>();

            if (!string.IsNullOrEmpty(Request.Form["isActive"]) && Request.Form["isActive"] == "on")
            {
                pageDic.is_active = 1;
            }
            else
            {
                pageDic.is_active = 0;
            }
            pageDic.general_table_id = tableId;
            if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PAYMENT_TYPE)
            {
                if (!string.IsNullOrEmpty(Request.Form["isRei"]) && Request.Form["isRei"] == "on")
                {
                    pageDic.ext1 = "1";
                }
                else
                {
                    pageDic.ext1 = "0";
                }
            }
            if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.TAX_REGION)
            {
                if (!string.IsNullOrEmpty(Request.Form["isDef"]) && Request.Form["isDef"] == "on")
                {
                    pageDic.ext1 = "1";
                }
                else
                {
                    pageDic.ext1 = "0";
                }
            }

            if (tableId == (int)GeneralTableEnum.TASK_LIBRARY_CATE || (tableId == (int)GeneralTableEnum.ACTION_TYPE) || tableId == (int)GeneralTableEnum.PROJECT_LINE_OF_BUSINESS || tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.TAX_REGION || tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PRODUCT_CATE)
            {
                pageDic.is_active = 1;
            }
            if (!isAdd)
            {
                if (tableId != (int)EMT.DoneNOW.DTO.GeneralTableEnum.SYS_TICKET_RESOLUTION_METRICS)
                {
                    thisGeneral.name = pageDic.name;
                }
                thisGeneral.is_active = pageDic.is_active;

                if (tableId == (int)GeneralTableEnum.TICKET_STATUS || tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PAYMENT_TYPE || tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PAYMENT_TERM || tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PAYMENT_SHIP_TYPE || tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.TAX_REGION)
                {
                    thisGeneral.ext1 = pageDic.ext1;
                }

                if (tableId == (int)DTO.GeneralTableEnum.TASK_SOURCE_TYPES)
                {
                    thisGeneral.sort_order = pageDic.sort_order;
                }
                else if (tableId == (int)GeneralTableEnum.TASK_LIBRARY_CATE)
                {
                    thisGeneral.status_id = pageDic.status_id;
                    thisGeneral.remark    = pageDic.remark;
                }
                else if (tableId == (int)GeneralTableEnum.ACTION_TYPE)
                {
                    if (thisGeneral.is_system != 1)
                    {
                        thisGeneral.name      = pageDic.name;
                        thisGeneral.ext2      = pageDic.ext2;
                        thisGeneral.status_id = pageDic.status_id;
                    }
                    thisGeneral.remark     = pageDic.remark;
                    thisGeneral.sort_order = pageDic.sort_order;
                }
                else if (tableId == (int)GeneralTableEnum.PROJECT_LINE_OF_BUSINESS)
                {
                    thisGeneral.remark     = pageDic.remark;
                    thisGeneral.sort_order = pageDic.sort_order;
                }
                else if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.SYSTEM_SUPPORT_EMAIL)
                {
                    thisGeneral.ext1 = pageDic.ext1;
                }
                else if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.SYS_TICKET_RESOLUTION_METRICS)
                {
                    thisGeneral.sort_order = pageDic.sort_order;
                    thisGeneral.ext1       = pageDic.ext1;
                }
                else if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PRODUCT_CATE)
                {
                    thisGeneral.remark    = pageDic.remark;
                    thisGeneral.parent_id = pageDic.parent_id;
                    thisGeneral.code      = pageDic.code;
                    thisGeneral.ext1      = pageDic.ext1;
                }
                else if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PAYMENT_TERM)
                {
                    thisGeneral.remark = pageDic.remark;
                }
                else if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PAYMENT_TYPE)
                {
                    thisGeneral.remark = pageDic.remark;
                }
                else if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.PAYMENT_SHIP_TYPE)
                {
                    thisGeneral.remark = pageDic.remark;
                }
            }

            bool result = false;

            if (isAdd)
            {
                result = genBll.AddGeneral(pageDic, LoginUserId);
            }
            else
            {
                result = genBll.EditGeneral(thisGeneral, LoginUserId);
            }
            if (tableId == (int)EMT.DoneNOW.DTO.GeneralTableEnum.TAX_REGION)
            {
                genBll.SetDefaultRegion((isAdd? pageDic.id:thisGeneral.id), LoginUserId);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');self.opener.location.reload();window.close();</script>");
        }