/// <summary>
        /// 物资修改信息提交
        /// update a record
        /// created by gy
        /// </summary>
        /// <param name="MaterialInfo"></param>
        /// <returns></returns>
        public ActionResult MaterialInfoEdit(T_GM_InfoMaterial MaterialInfo)
        {
            MaterialInfo.InputTime   = DateTime.Now;
            MaterialInfo.InputPerson = user.EmployeeId;
            //-------------------------------
            var    uploadfile  = this.GetCmp <FileUploadField>("AttachmentPath");
            int    filesize    = uploadfile.PostedFile.ContentLength;
            string fileoldname = uploadfile.FileName;

            if (filesize > 20 * 1024 * 1024)
            {
                X.Msg.Alert("提示", "上传文件过大,大小必须低于20M").Show();
                return(this.Direct());
            }
            if (uploadfile.HasFile)
            {
                string filenewname = Guid.NewGuid().ToString() + Path.GetExtension(fileoldname);
                string logicpath   = "~/AttachFile/MaterialInfo/" + filenewname;
                string filepath    = Server.MapPath(logicpath);
                MaterialInfo.PicturePath = logicpath;
                uploadfile.PostedFile.SaveAs(filepath);
            }
            //--------------------------------
            DB.T_GM_InfoMaterial.Attach(MaterialInfo);
            DB.Entry(MaterialInfo).State = EntityState.Modified;
            DB.SaveChanges();
            return(this.Direct(true));
        }
        public ActionResult MaterialInfoAdd(T_GM_InfoMaterial MaterialInfo)
        {
            MaterialInfo.InputTime   = DateTime.Now;
            MaterialInfo.InputPerson = user.EmployeeId;
            //decimal uid=DB.T_GM_InfoMaterial.ToList().LastOrDefault().UID;
            //MaterialInfo.MaterialID = MaterialInfo.Type + (uid + 1).ToString();

            var    uploadfile  = this.GetCmp <FileUploadField>("AttachmentPath");
            int    filesize    = uploadfile.PostedFile.ContentLength;
            string fileoldname = uploadfile.FileName;

            if (filesize > 20 * 1024 * 1024)
            {
                X.Msg.Alert("提示", "上传文件过大,大小必须低于20M").Show();
                return(this.Direct());
            }
            if (uploadfile.HasFile)
            {
                string filenewname = Guid.NewGuid().ToString() + Path.GetExtension(fileoldname);
                string logicpath   = "~/AttachFile/MaterialInfo/" + filenewname;
                string filepath    = Server.MapPath(logicpath);
                MaterialInfo.PicturePath = logicpath;
                uploadfile.PostedFile.SaveAs(filepath);
            }
            DB.T_GM_InfoMaterial.Add(MaterialInfo);
            DB.SaveChanges();
            DirectResult r = new DirectResult();

            r.IsUpload = true;
            return(r);
        }