示例#1
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(string id)
        {
            var entity = new ComResourceEntity();

            if (!string.IsNullOrEmpty(id))
            {
                entity = new ComResourceBll().Get(id);
            }
            return(View(entity));
        }
示例#2
0
        public JsonResult Submit(ComResourceEntity comResource)
        {
            var rtState = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    comResource.RowStatus = 1;
                    if (string.IsNullOrEmpty(comResource.Id))
                    {
                        comResource.Id        = new ComResourceBll().GetMaxId(comResource.ParentId);
                        comResource.CreateBy  = CurrentUser.CrmUser.UserName;
                        comResource.CreateOn  = DateTime.Now;
                        comResource.CreatorId = CurrentUser.CrmUser.Id;
                        comResource.UpdateBy  = CurrentUser.CrmUser.UserName;
                        comResource.UpdateId  = CurrentUser.CrmUser.Id;
                        comResource.UpdateOn  = DateTime.Now;

                        new ComResourceBll().Add(comResource);
                    }
                    else
                    {
                        if ((DateTime.Compare(comResource.CreateOn, Convert.ToDateTime("1901-01-01")) < 0))
                        {
                            comResource.CreateOn = Convert.ToDateTime("1901-01-01");
                        }
                        comResource.UpdateBy = CurrentUser.CrmUser.UserName;
                        comResource.UpdateId = CurrentUser.CrmUser.Id;
                        comResource.UpdateOn = DateTime.Now;
                        new ComResourceBll().Update(comResource);
                    }
                    rtState = 0;
                }
            }
            catch (Exception)
            {
                rtState = 1;
            }
            var rtEntity = new StatusModel <DBNull>
            {
                rtData  = null,
                rtMsrg  = "成功",
                rtState = rtState
            };

            return(Json(rtEntity, JsonRequestBehavior.AllowGet));
        }