/// <summary>
 /// 保存管线信息(管线信息页面起止人井信息保存)
 /// </summary>
 /// <returns></returns>
 public ActionResult EditGxxx(FormCollection form)
 {
     try
     {
         var id    = ConvertUtility.ToDecimal(form["Gxxxid"]);
         var model = gxxxBusiness.Find(id);
         if (model == null)
         {
             return(Json(AjaxResult.Error("请保存管线基本信息后再保存管线起止井信息")));
         }
         GX_GXXX gxxx = new GX_GXXX();
         gxxx = model;
         //起止井位置信息
         gxxx.QJ = form["Qjszwz"];
         gxxx.ZJ = form["Zjszwz"];
         //起止井所在管孔位置
         gxxx.QJGKWZ     = form["gxszgkqjwz"];
         gxxx.ZJGKWZ     = form["gxszgkwz"];
         gxxx.MODIFYBY   = CurrentUser.UserName;
         gxxx.MODIFYTIME = DateTime.Now;
         gxxxBusiness.UpdateEntity(model);
         var ret = gxxxBusiness.SaveChange();
         return(Json(ret > 0 ? AjaxResult.Success("数据操作成功") : AjaxResult.Error("数据操作失败")));
     }
     catch (Exception ex)
     {
         return(Json(AjaxResult.Error("删除失败:" + (ex.InnerException != null ? ex.InnerException.Message : ex.Message))));
     }
 }
        public ActionResult AddJbxx(FormCollection form, GX_GXXX gxxx)
        {
            gxxx.ID = ConvertUtility.ToDecimal(form["Gxxxid"]);
            var model = gxxxBusiness.Find(ConvertUtility.ToDecimal(form["Gxxxid"]));

            if (model == null)
            {
                //如果页面未关闭 多次点击保存按钮 验证是否存在 不存在生成数据
                gxxxBusiness.AddEntity(gxxx);
                gxxxBusiness.SaveChange();
            }
            //如果页面数据存在 则编辑数据
            gxxx.XMYSXXID   = ConvertUtility.ToDecimal(form["ysid"]);
            gxxx.GCBH       = form["GXBH"];
            gxxx.GXWZ       = form["GXWZ"];
            gxxx.GXCD       = ConvertUtility.ToDecimal(form["GXCD"]);
            gxxx.DXLX       = form["DXLX"];
            gxxx.GXLX       = form["GXLX"];
            gxxx.JSZT       = form["JSZT"];
            gxxx.YWLX       = form["YWLX"];
            gxxx.GJZ        = form["GJZ"];
            gxxx.XNZC       = form["XNZC"];
            gxxx.GKCL       = form["GKCL"];
            gxxx.SYZT       = ConvertUtility.ToDecimal(form["SYZT"]);
            gxxx.GKHS       = ConvertUtility.ToDecimal(form["GKHS"]);
            gxxx.GKLS       = ConvertUtility.ToDecimal(form["GCBH"]);
            gxxx.PLSX       = ConvertUtility.ToDecimal(form["GCBH"]);
            gxxx.GXZT       = form["GCBH"];
            gxxx.CREATEBY   = CurrentUser.UserName;
            gxxx.CREATETIME = DateTime.Now;
            gxxxBusiness.UpdateEntity(gxxx);
            ViewData["GxxxId"] = gxxx.ID;
            return(Json(gxxxBusiness.SaveChange() > 0 ? AjaxResult.Success("数据操作成功!") : AjaxResult.Error("数据操作失败!")));
        }
        public ActionResult EditJbxx(FormCollection form, GX_GXXX gxxx)
        {
            var id    = ConvertUtility.ToDecimal(form["Gxxxid"]);
            var model = gxxxBusiness.Find(id);

            if (model == null)
            {
                return(Json(AjaxResult.Error("未找到需要更新的数据")));
            }
            gxxx.XMYSXXID   = ConvertUtility.ToDecimal(form["ysid"]);
            gxxx.GCBH       = form["GXBH"];
            gxxx.GXWZ       = form["GXWZ"];
            gxxx.GXCD       = ConvertUtility.ToDecimal(form["GXCD"]);
            gxxx.DXLX       = form["DXLX"];
            gxxx.GXLX       = form["GXLX"];
            gxxx.JSZT       = form["JSZT"];
            gxxx.YWLX       = form["YWLX"];
            gxxx.GJZ        = form["GJZ"];
            gxxx.XNZC       = form["XNZC"];
            gxxx.GKCL       = form["GKCL"];
            gxxx.SYZT       = ConvertUtility.ToDecimal(form["SYZT"]);
            gxxx.GKHS       = ConvertUtility.ToDecimal(form["GKHS"]);
            gxxx.GKLS       = ConvertUtility.ToDecimal(form["GCBH"]);
            gxxx.PLSX       = ConvertUtility.ToDecimal(form["GCBH"]);
            gxxx.GXZT       = form["GCBH"];
            gxxx.MODIFYBY   = CurrentUser.UserName;
            gxxx.MODIFYTIME = DateTime.Now;
            gxxxBusiness.UpdateEntity(gxxx);
            ViewData["GxxxId"] = gxxx.ID;
            return(Json(gxxxBusiness.SaveChange() > 0 ? AjaxResult.Success("数据操作成功!") : AjaxResult.Error("数据操作失败!")));
        }
        /// <summary>
        /// 保存管孔信息
        /// </summary>
        /// <returns></returns>
        public ActionResult EditGkxx(FormCollection form)
        {
            if (string.IsNullOrEmpty(form["gkhsParent"]) || string.IsNullOrEmpty(form["gklsParent"]))
            {
                AjaxResult.Error("请选择管孔所在位置!");
            }
            var id   = ConvertUtility.ToDecimal(form["GkxxId"]);
            var gkxx = gxxxBusiness.FindGkxx(id);

            if (gkxx == null)
            {
                AjaxResult.Error("未找到需要更新的数据!");
            }
            gkxx.GKBH       = form["GKXX"];
            gkxx.GKCL       = form["GKXXGKCL"];
            gkxx.SYZT       = ConvertUtility.ToDecimal(form["GKXXSYZT"]);
            gkxx.ZKHS       = ConvertUtility.ToDecimal(form["GKHS1"]);
            gkxx.ZKLS       = ConvertUtility.ToDecimal(form["GKLS1"]);
            gkxx.ZKSL       = ConvertUtility.ToDecimal(form["GXSL"]);
            gkxx.GKSZH      = ConvertUtility.ToDecimal(form["gkhsParent"]);
            gkxx.GKSZL      = ConvertUtility.ToDecimal(form["gklsParent"]);
            gkxx.MODIFYBY   = CurrentUser.UserName;
            gkxx.MODIFYTIME = DateTime.Now;
            gxxxBusiness.UpdateGkxx(gkxx);
            return(Json(gxxxBusiness.SaveChange() > 0 ? AjaxResult.Success("数据操作成功!") : AjaxResult.Error("数据操作失败!")));
        }
示例#5
0
 public ActionResult Add(FormCollection form, GX_RJXX gxrjxx)
 {
     try
     {
         gxrjxx.ID         = new Common().GetRandom();
         gxrjxx.RJBH       = new Common().GetRandom().ToString();
         gxrjxx.RJZT       = "1";
         gxrjxx.XMYSXXID   = ConvertUtility.ToDecimal(form["Id"]);
         gxrjxx.GCBH       = form["gcbh"];
         gxrjxx.RJMC       = form["RJMC"];
         gxrjxx.GJZ        = gxrjxx.GCBH + "_" + form["GCRJBH"];
         gxrjxx.GCRJBH     = form["GCRJBH"];
         gxrjxx.JGSL       = ConvertUtility.ToInt(form["JGSL"]);
         gxrjxx.DXLX       = form["DXLX"];
         gxrjxx.RSJCC      = form["RSJCC"];
         gxrjxx.DXLX       = form["DXLX"];
         gxrjxx.LONGITUDE  = form["LONGITUDE"];
         gxrjxx.LATITUDE   = form["LATITUDE"];
         gxrjxx.CREATEBY   = CurrentUser.UserName;
         gxrjxx.CREATETIME = DateTime.Now;
         gxXlzxBusiness.Add(gxrjxx);
         return(Json(gxXlzxBusiness.SaveChange() > 0 ? AjaxResult.Success("数据操作成功!") : AjaxResult.Error("数据操作失败!")));
     }
     catch (Exception ex) {
         return(Json(AjaxResult.Error("数据操作失败!")));
     }
 }
        public PartialViewResult Edit()
        {
            var id    = ConvertUtility.ToDecimal(Request["key"]);
            var model = dictConfigBusiness.FindDictConfig(id);

            return(PartialView(model));
        }
示例#7
0
        public ActionResult RoleMenuList(int page = 1, int rows = 15)
        {
            var roleId = ConvertUtility.ToDecimal(Request["roleId"]);
            int totalRecord;
            var list = gxSysMenuBusniess.FindAllRoleMenuList(roleId, page, rows, out totalRecord);

            return(Json(new { total = totalRecord, rows = list }));
        }
        public ActionResult UserRoleList(int page = 1, int rows = 15)
        {
            var userid = ConvertUtility.ToDecimal(Request["userid"]);
            int totalRecord;
            var list = gxSysRoleBusiness.FindAllUserRoleByUserId(userid, page, rows, out totalRecord);

            return(Json(new { total = totalRecord, rows = list }));
        }
        public ActionResult List(int page, int rows)
        {
            int reacordCount = 0;
            var roleid       = ConvertUtility.ToDecimal(Request["roleid"]);
            var list         = gxXlzxBusiness.FindAlXlzxList(roleid, page, rows, out reacordCount);

            return(Json(new { total = reacordCount, rows = list }));
        }
        public PartialViewResult TaskResignView()
        {
            ViewData["gcxmid"] = ConvertUtility.ToString(Request["gcxmid"]);
            var id    = ConvertUtility.ToDecimal(Request["gcxmid"]);
            var model = gxProjectBusniess.Find(id);

            return(PartialView(model));
        }
        /// <summary>
        /// 管线信息编辑
        /// </summary>
        /// <returns></returns>
        public PartialViewResult Edit()
        {
            var id = ConvertUtility.ToDecimal(Request["id"]);

            if (id <= 0)
            {
                return(PartialView(new GxRjxxModel()));
            }
            //获取页面基本信息保存按钮权限
            var ysryRole = System.Configuration.ConfigurationManager.AppSettings["YsryRole"];
            var sgryRole = System.Configuration.ConfigurationManager.AppSettings["SgryRole"];

            ViewData["YsryUserRole"] = gxSysUserRoleBusiness.FindRoleByUserIdAndRleName(ysryRole, CurrentUser.Id) == null ? "" : "Ysry";
            ViewData["SgryUserRole"] = gxSysUserRoleBusiness.FindRoleByUserIdAndRleName(sgryRole, CurrentUser.Id) == null ? "" : "Sgry";

            GxRjxxModel gxRjxxModel = new GxRjxxModel();
            var         gxxxModel   = gxxxBusiness.Find(id);

            gxRjxxModel.ID = gxxxModel.ID;

            gxRjxxModel.GCBH = gxxxModel.GCBH;
            gxRjxxModel.GXWZ = gxxxModel.GXWZ;
            gxRjxxModel.GXCD = gxxxModel.GXCD;
            gxRjxxModel.DXLX = gxxxModel.DXLX;
            gxRjxxModel.GXLX = gxxxModel.GXLX;
            gxRjxxModel.JSZT = gxxxModel.JSZT;
            gxRjxxModel.YWLX = gxxxModel.YWLX;
            gxRjxxModel.GJZ  = gxxxModel.GJZ;
            gxRjxxModel.XNZC = gxxxModel.XNZC;
            gxRjxxModel.GKCL = gxxxModel.GKCL;
            gxRjxxModel.SYZT = gxxxModel.SYZT;
            gxRjxxModel.GKHS = gxxxModel.GKHS;
            gxRjxxModel.GKLS = gxxxModel.GKLS;
            gxRjxxModel.PLSX = gxxxModel.PLSX;
            gxRjxxModel.GXZT = gxxxModel.GXZT;
            gxRjxxModel.GH   = gxxxModel.GH;
            gxRjxxModel.JJ   = gxxxModel.JJ;
            gxRjxxModel.STQK = gxxxModel.STQK;
            gxRjxxModel.QJ   = gxxxModel.QJ;
            gxRjxxModel.ZJ   = gxxxModel.ZJ;
            var gxGkxx = gxxxBusiness.FindGkxx(gxxxModel.ID);

            //如果管孔信息不存在 则生成新的管孔编号
            gxRjxxModel.GKBH   = gxGkxx == null ? "" : ("GK" + new Common().GetRandom().ToString());
            gxRjxxModel.ZKHS   = gxGkxx == null ? 0 : gxGkxx.ZKHS;
            gxRjxxModel.ZKLS   = gxGkxx == null ? 0 : gxGkxx.ZKLS;
            gxRjxxModel.ZKSL   = gxGkxx == null ? 0 : gxGkxx.ZKSL;
            gxRjxxModel.GKSZH  = gxGkxx == null ? 0 : gxGkxx.GKSZH;
            gxRjxxModel.GKSZL  = gxGkxx == null ? 0 : gxGkxx.GKSZL;
            gxRjxxModel.Qjwz   = gxxxModel.QJGKWZ;
            gxRjxxModel.Zjwz   = gxxxModel.ZJGKWZ;
            gxRjxxModel.gcxmid = gxxxModel.XMYSXXID;
            gxRjxxModel.GkxxId = gxGkxx == null ? 0 : gxGkxx.ID;

            ViewData["QjWz"] = GetRjmcById(ConvertUtility.ToDecimal(gxxxModel.QJ));
            ViewData["ZjWz"] = GetRjmcById(ConvertUtility.ToDecimal(gxxxModel.ZJ));
            return(PartialView(gxRjxxModel));
        }
示例#12
0
        public ActionResult List(int page = 1, int rows = 15)
        {
            int reacordCount = 0;
            var gcxmid       = ConvertUtility.ToDecimal(Request["gcxmid"]);
            var rxbh         = ConvertUtility.ToString(Request["rxbh"]);
            var list         = gxXlzxBusiness.FindAllGXRJXX(gcxmid, rxbh, page, rows, out reacordCount);

            return(Json(new { total = reacordCount, rows = list }));
        }
        /// <summary>
        /// 获取文件列表
        /// </summary>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <returns></returns>
        public ActionResult GetFileList(int page, int rows)
        {
            int     totalRecord = 0;
            decimal gcxmid      = ConvertUtility.ToDecimal(Request["gcxmid"]);
            var     type        = ConvertUtility.ToInt(Request["type"]);
            var     list        = gxYszlfileBusiness.FindAlXlzxList(type, gcxmid, page, rows, out totalRecord);

            return(Json(new { total = totalRecord, rows = list }));
        }
示例#14
0
        public PartialViewResult Add()
        {
            ViewData["gcxmid"] = ConvertUtility.ToDecimal(Request["gcxmid"]);
            var model = gxYsxmxxBusiness.FindEntity(ConvertUtility.ToDecimal(Request["gcxmid"]));

            ViewData["gcbh"] = model == null ? "" : model.GCBH;
            ViewData["gcmc"] = model == null ? "" : model.GCBH;
            return(PartialView());
        }
示例#15
0
        public PartialViewResult Edit()
        {
            var model       = gxXlzxBusiness.Find(ConvertUtility.ToDecimal(Request["id"]));
            var ysxmxxModel = gxYsxmxxBusiness.FindEntity(ConvertUtility.ToDecimal(model.XMYSXXID));

            ViewData["gcbh"]        = ysxmxxModel == null ? "" : ysxmxxModel.GCBH;
            ViewData["gcmc"]        = ysxmxxModel == null ? "" : ysxmxxModel.GCBH;
            ViewData["photoGrally"] = gxPhotogalleryBusiness.Find(ConvertUtility.ToDecimal(Request["id"]));
            return(PartialView(model));
        }
示例#16
0
        /// <summary>
        /// 管线信息页面选择人井信息
        /// </summary>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <returns></returns>
        public ActionResult RjxxList(int page, int rows)
        {
            //项目工程编号
            var    ysxmid       = ConvertUtility.ToDecimal(Request["ysxmid"]);
            int    reacordCount = 0;
            string gxbh         = ConvertUtility.ToString(Request["gxbh"]);
            var    list         = gxXlzxBusiness.FindAllGxrjxxByYsXmIdRjmx(ysxmid, gxbh, page, rows, out reacordCount);

            return(Json(new { total = reacordCount, rows = list }, JsonRequestBehavior.AllowGet));
        }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string        httpMehtod  = Request.HttpMethod;
                UnitCtService unitService = new UnitCtService();
                if (httpMehtod.Equals("get", StringComparison.OrdinalIgnoreCase))
                {
                    this.UnitId = ConvertUtility.Trim(Request.QueryString["id"]);
                    string[] unitIdCollection = this.UnitId.Split(new string[] { AppSettings.FirstSplit }, StringSplitOptions.RemoveEmptyEntries);

                    if (unitIdCollection != null && unitIdCollection.Length > 0)
                    {
                        List <string>  unit         = new List <string>();
                        BuildCtService buildService = new BuildCtService();
                        foreach (var item in unitIdCollection)
                        {
                            var centaUnit = unitService.GetUnit("");
                            unit.Add(centaUnit.CY_Axis + centaUnit.CX_Axis);
                            if (string.IsNullOrEmpty(this.EstateName) && string.IsNullOrEmpty(this.BuildName))
                            {
                                var build = buildService.GetBuild(centaUnit.BuildId);
                                this.BuildName  = build.BuildName;
                                this.EstateName = build.Estate.EstateName;
                                this.Address    = build.Estate.Address;
                            }
                        }
                        this.UnitCollection = string.Join(",", unit.ToArray());
                    }
                }
                else
                {
                    string   unitId           = ConvertUtility.Trim(Request.Form["unitId"]);
                    string[] unitIdCollection = unitId.Split(new string[] { AppSettings.FirstSplit }, StringSplitOptions.RemoveEmptyEntries);
                    decimal  area             = ConvertUtility.ToDecimal(Request.Form["area"]);
                    int      countf           = ConvertUtility.ToInt(Request.Form["countf"]);
                    int      countt           = ConvertUtility.ToInt(Request.Form["countt"]);
                    int      countw           = ConvertUtility.ToInt(Request.Form["countw"]);
                    string   direction        = ConvertUtility.Trim(Request.Form["direction"]);
                    //if (unitService.UpdateUnit(unitIdCollection, area, countf, countt, countw, direction))
                    //{
                    //    Response.Write("true");
                    //}
                    //else
                    //{
                    //    Response.Write("false");
                    //}
                    Response.End();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult AddRoleUser(FormCollection form)
        {
            var userid = ConvertUtility.ToDecimal(form["userid"]);
            GX_SYS_USERROLERELATE gxSys = new GX_SYS_USERROLERELATE();

            gxSys.ID     = common.GetRandom();
            gxSys.ROLEID = ConvertUtility.ToDecimal(form["roleid"]);
            gxSys.USERID = userid;
            business.AddEntity(gxSys);
            return(Json(gxSysRoleBusiness.SaveChange() > 0 ? AjaxResult.Success("删除成功") : AjaxResult.Error("删除失败")));
        }
        public ActionResult Add(FormCollection form, GX_XLZX gxXlzx)
        {
            gxXlzx.ID         = new Common().GetRandom();
            gxXlzx.NAME       = form["name"];
            gxXlzx.ROLEID     = ConvertUtility.ToDecimal(form["roleId"]);
            gxXlzx.CREATEBY   = CurrentUser.UserName;
            gxXlzx.CREATETIME = DateTime.Now;
            gxXlzxBusiness.AddEntity(gxXlzx);

            return(Json(gxXlzxBusiness.SaveChange() > 0 ? AjaxResult.Error("数据操作成功!") : AjaxResult.Error("数据操作失败!")));
        }
示例#20
0
        public ActionResult AddRoleMenu(FormCollection form)
        {
            var             roleId = ConvertUtility.ToDecimal(Request.Form["RoleId"]);
            GX_SYS_ROLEMENU gxSys  = new GX_SYS_ROLEMENU();

            gxSys.ID     = common.GetRandom();
            gxSys.ROLEID = roleId;
            gxSys.MENUID = ConvertUtility.ToDecimal(Request.Form["ROLENAME"]);
            gxSysRoleMenuBusniess.Add(gxSys);
            return(Json(gxSysRoleMenuBusniess.SaveChange() > 0 ? AjaxResult.Success("添加成功") : AjaxResult.Error("添加失败")));
        }
        /// <summary>
        /// 管线信息管理
        /// </summary>
        /// <returns></returns>
        public PartialViewResult Gxxx()
        {
            ViewData["xmgcid"] = ConvertUtility.ToString(Request["gcbdid"]);
            var model = gxYsxmxxBusiness.FindEntity(ConvertUtility.ToDecimal(Request["gcbdid"]));

            ViewData["gcbh"] = model == null ? "" : model.GCBH;
            ViewData["gcmc"] = model == null ? "" : model.GCBH;
            var userModel = gxSysUserBusiness.FindGxSysUser(ConvertUtility.ToDecimal(model == null ? "0" : model.SGDWMC));

            ViewData["sgdwmc"] = userModel == null ? "" : userModel.USERNAME;
            return(PartialView());
        }
        public ActionResult GetDictConfigByParentId()
        {
            var parentId = ConvertUtility.ToDecimal(Request["id"]);
            var list     = dictConfigBusiness.FindAllDictConfig().Where(t => t.PARENTID == parentId).ToList();
            var listData = list.Select(c => new EasyuiDropDown {
                Value = c.ID.ToString(), Text = c.NAME
            }).ToList();

            listData.Insert(0, new EasyuiDropDown {
                Value = "0", Text = "请选择"
            });
            return(Json(listData));
        }
        public ActionResult GetDictConfigByName()
        {
            var dictId   = ConvertUtility.ToDecimal(Request["name"]);
            var list     = dictConfigBusiness.FindAllDictConfig(dictId).ToList();
            var listData = list.Select(c => new EasyuiDropDown {
                Value = c.ID.ToString(), Text = c.NAME
            }).ToList();

            listData.Insert(0, new EasyuiDropDown {
                Value = "0", Text = "请选择"
            });
            return(Json(listData));
        }
        public ActionResult GetXlzxListByRoleId()
        {
            GxXlzxBusiness sysUserBusiness = new GxXlzxBusiness();
            var            roleId          = ConvertUtility.ToDecimal(Request["roleid"]);
            var            list            = sysUserBusiness.FindAllModels().Where(t => t.ROLEID == roleId).ToList();
            var            listData        = list.Select(c => new EasyuiDropDown {
                Value = c.ID.ToString(), Text = c.NAME
            }).ToList();

            listData.Insert(0, new EasyuiDropDown {
                Value = "0", Text = "请选择"
            });
            return(Json(listData));
        }
        /// <summary>
        /// 图片下载
        /// </summary>
        /// <returns></returns>
        public FileContentResult DownLoadFile()
        {
            var id    = ConvertUtility.ToDecimal(Request["id"]);
            var model = gxYszlfileBusiness.Find(id);

            byte[] fileContent = null;
            string mimeType    = model.FILEURL.Substring(model.FILEURL.LastIndexOf('.'));
            string fileName    = "";

            fileContent = SetImgToByte(model.FILEURL);
            fileName    = model.FILENAME;

            return(File(fileContent, mimeType, fileName + mimeType));
        }
        public ActionResult OprRw(FormCollection form)
        {
            var id    = ConvertUtility.ToDecimal(form["gcxmid"]);
            var model = gxProjectBusniess.Find(id);

            if (model == null)
            {
                return(Json(AjaxResult.Error("未找到分配的项目")));
            }
            //线路中心
            model.XLZX = form["CheckMan"];
            //分配的人员
            model.YSRY = form["LineServiceCenter"];
            gxProjectBusniess.Update(model);
            return(Json(gxProjectBusniess.SaveChange() > 0 ? AjaxResult.Success("任务分配操作成功") : AjaxResult.Error("任务分配操作失败")));
        }
 public ActionResult Save()
 {
     try
     {
         var gcxmid = ConvertUtility.ToDecimal(Request["id"]);
         GxLeaveOpinionBusiness opinionBusiness = new GxLeaveOpinionBusiness();
         GX_LEAVEOPINION        oLeaveopinion   = new GX_LEAVEOPINION();
         oLeaveopinion.APPINSTANCEID = gcxmid;
         opinionBusiness.Add(oLeaveopinion);
         return(Json(opinionBusiness.SaveChange() > 0 ? AjaxResult.Success("数据提交成功") : AjaxResult.Error("数据提交失败")));
     }
     catch (Exception ex)
     {
         return(Json(AjaxResult.Error("数据提交失败:" + (ex.InnerException == null ? ex.Message : ex.InnerException.Message))));
     }
 }
 public ActionResult Add(FormCollection form, GX_DICT_CONFIG dictConfig)
 {
     dictConfig.ID   = new Common().GetRandom();
     dictConfig.NAME = form["Name"];
     if (string.IsNullOrEmpty(dictConfig.NAME))
     {
         return(Json(AjaxResult.Error("字典名称不能为空!")));
     }
     dictConfig.PARENTID   = ConvertUtility.ToDecimal(form["PreId"]);
     dictConfig.STATUS     = ConvertUtility.ToString(form["STATUS"]);
     dictConfig.DICTDESC   = form["Bz"];
     dictConfig.CREATEBY   = CurrentUser.UserName;
     dictConfig.CREATETIME = DateTime.Now;
     dictConfigBusiness.AddEntity(dictConfig);
     return(Json(dictConfigBusiness.SaveChange() > 0 ? AjaxResult.Success("数据修改成功") : AjaxResult.Error("数据修改失败")));
 }
        public ActionResult FileUpload(FormCollection form)
        {
            HttpFileCollectionBase files = Request.Files;
            var file = files[0];

            if (file == null)
            {
                return(Json(AjaxResult.Error("未找到需要上传的图片")));
            }
            if (file.ContentLength <= 0)
            {
                return(Json(AjaxResult.Error("未找到需要上传的图片")));
            }
            var extension = Path.GetExtension(file.FileName);

            if (extension != null)
            {
                extension = extension.ToLower();
            }
            if (extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".gif" || extension == ".dwg")
            {
                //上传原图
                string folder = Server.MapPath("~/Upload/gx/");
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
                string originalPath = folder + Guid.NewGuid() + Path.GetExtension(file.FileName);
                file.SaveAs(originalPath);
                GX_YSZLFILE yszlfile = new GX_YSZLFILE();
                yszlfile.ID         = new Common().GetRandom();
                yszlfile.TYPE       = ConvertUtility.ToDecimal(Request["type"]);
                yszlfile.FILEURL    = originalPath;
                yszlfile.XMYSXXID   = ConvertUtility.ToDecimal(form["gcxmid"]);
                yszlfile.CREATEBY   = CurrentUser.UserName;
                yszlfile.UPLOADTIME = DateTime.Now;
                yszlfile.FILEZT     = "1";
                yszlfile.FILENAME   = file.FileName.Substring(0, file.FileName.LastIndexOf('.'));
                yszlfile.FILESIZE   = file.ContentLength;
                gxYszlfileBusiness.AddEntity(yszlfile);
                return(Json(gxYszlfileBusiness.SaveChange() > 0 ? AjaxResult.Success("图片上传成功") : AjaxResult.Error("图片上传失败")));
            }
            else
            {
                return(Json(AjaxResult.Error("上传的图片格式有误")));
            }
        }
示例#30
0
 public ActionResult Add(FormCollection form, GX_SYS_MENU gxSysMenu)
 {
     gxSysMenu.ID         = new Common().GetRandom();
     gxSysMenu.MENUNAMC   = form["MENUNAMC"];
     gxSysMenu.MODELID    = ConvertUtility.ToDecimal(form["MODELID"]);
     gxSysMenu.MENUURL    = form["MENUURL"];
     gxSysMenu.MENUBZ     = form["MENUBZ"];
     gxSysMenu.MENUSTATUS = ConvertUtility.ToDecimal(form["MENUSTATUS"]);
     if (gxSysMenu.MODELID <= 0)
     {
         return(Json(AjaxResult.Error("请选择菜单所属类型!")));
     }
     gxSysMenu.CREATEBY   = CurrentUser.UserName;
     gxSysMenu.CREATETIME = DateTime.Now;
     gxSysMenuBusniess.AddEntity(gxSysMenu);
     return(Json(gxSysMenuBusniess.SaveChange() > 0 ? AjaxResult.Error("数据操作成功!") : AjaxResult.Error("数据操作失败!")));
 }