コード例 #1
0
        protected void save_close_Click(object sender, EventArgs e)
        {
            bool result = false;
            var  img    = Request.Files["file"];

            if (img != null)
            {
                if (!img.ContentType.Contains("image"))  //图片
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('请上传图片!');</script>");
                    return;
                }
                if (!(img.ContentLength < (10 << 20)))  // 大小
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('请上传小于10M的图片!');</script>");
                    return;
                }
                string fileExtension = Path.GetExtension(img.FileName).ToLower();
                string filepath      = $"/Upload/Attachment/{DateTime.Now.ToString("yyyyMM")}/";
                if (Directory.Exists(Server.MapPath(filepath)) == false)    //如果不存在就创建文件夹
                {
                    Directory.CreateDirectory(Server.MapPath(filepath));
                }
                string virpath = filepath + Guid.NewGuid().ToString() + fileExtension; //这是存到服务器上的虚拟路径
                string mappath = Server.MapPath(virpath);                              //转换成服务器上的物理路径
                img.SaveAs(mappath);
                thisGeneral.ext2 = virpath;
                result           = genBll.EditGeneral(thisGeneral, LoginUserId);
            }
            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');self.opener.location.reload();window.close();</script>");
        }
コード例 #2
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.parent_id        = parentId;
            pageDic.general_table_id = tableId;
            if (!isAdd)
            {
                thisIssue.name      = pageDic.name;
                thisIssue.is_active = pageDic.is_active;
                thisIssue.ext1      = pageDic.ext1;
            }
            bool result = false;

            if (isAdd)
            {
                result = genBll.AddGeneral(pageDic, LoginUserId);
            }
            else
            {
                result = genBll.EditGeneral(thisIssue, LoginUserId);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');self.opener.location.reload();window.close();</script>");
        }
コード例 #3
0
        protected void save_close_Click(object sender, EventArgs e)
        {
            var pageDic = AssembleModel <d_general>();

            pageDic.general_table_id = (int)GeneralTableEnum.QUOTE_ITEM_TAX_CATE;
            if (!isAdd)
            {
                thisTaxCate.name      = pageDic.name;
                thisTaxCate.remark    = pageDic.remark;
                thisTaxCate.is_active = pageDic.is_active;
            }


            string ids = "";

            if (!string.IsNullOrEmpty(Request.Form["workTypeIds"]))
            {
                ids += Request.Form["workTypeIds"] + ',';
            }
            if (!string.IsNullOrEmpty(Request.Form["materialIds"]))
            {
                ids += Request.Form["materialIds"] + ',';
            }
            if (!string.IsNullOrEmpty(Request.Form["serviceIds"]))
            {
                ids += Request.Form["serviceIds"] + ',';
            }
            if (!string.IsNullOrEmpty(Request.Form["expenseIds"]))
            {
                ids += Request.Form["expenseIds"] + ',';
            }
            if (!string.IsNullOrEmpty(Request.Form["milestoneIds"]))
            {
                ids += Request.Form["milestoneIds"] + ',';
            }
            if (!string.IsNullOrEmpty(ids))
            {
                ids = ids.Substring(0, ids.Length - 1);
            }

            bool result = false;

            if (isAdd)
            {
                result = genBll.AddGeneral(pageDic, LoginUserId);
                codeBll.ChangeCodeTaxCate(ids, pageDic.id, LoginUserId);
            }
            else
            {
                result = genBll.EditGeneral(thisTaxCate, LoginUserId);
                codeBll.ChangeCodeTaxCate(ids, thisTaxCate.id, LoginUserId);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');self.opener.location.reload();window.close();</script>");
        }
コード例 #4
0
ファイル: ResourceDicForm.aspx.cs プロジェクト: evelh/Done
        protected void save_close_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Request.Form["name"]) || string.IsNullOrEmpty(Request.Form["cateId"]))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert(‘未获取到名称或类别,请重试!');</script>");
                return;
            }
            d_general pageDic = new d_general()
            {
                name             = Request.Form["name"],
                parent_id        = int.Parse(Request.Form["cateId"]),
                remark           = Request.Form["remark"],
                is_active        = (sbyte)(!string.IsNullOrEmpty(Request.Form["isActive"]) && Request.Form["isActive"] == "on" ? 1 : 0),
                general_table_id = (int)GeneralTableEnum.RESOURCE_SKILL_TYPE,
            };

            if (isAdd)
            {
                thisDic = pageDic;
            }
            else
            {
                thisDic.name      = pageDic.name;
                thisDic.parent_id = pageDic.parent_id;
                thisDic.remark    = pageDic.remark;
                thisDic.is_active = pageDic.is_active;
            }
            bool result = false;

            if (isAdd)
            {
                result = genBll.AddGeneral(thisDic, LoginUserId);
            }
            else
            {
                result = genBll.EditGeneral(thisDic, LoginUserId);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result?"成功":"失败")}!');self.opener.location.reload();window.close();</script>");
        }
コード例 #5
0
        protected void save_close_Click(object sender, EventArgs e)
        {
            var pageGen = AssembleModel <d_general>();

            pageGen.general_table_id = (int)GeneralTableEnum.GENERAL_LEDGER;
            if (!isAdd)
            {
                ledger.name   = pageGen.name;
                ledger.remark = pageGen.remark;
            }
            bool result = false;

            if (isAdd)
            {
                result = genBll.AddGeneral(pageGen, LoginUserId);
            }
            else
            {
                result = genBll.EditGeneral(ledger, LoginUserId);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');self.opener.location.reload();window.close();</script>");
        }
コード例 #6
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>");
        }