Esempio n. 1
0
        public FuncResult Add(PostOrgModel mode, string userid)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功"
            };

            try
            {
                ApdDimOrg org = new ApdDimOrg()
                {
                    RecordId     = Guid.NewGuid().ToString(),
                    CreationDate = DateTime.Now,
                    //CreatedBy = Convert.ToDecimal(userid),
                    LastUpdateDate = DateTime.Now,
                    //LastUpdatedBy = Convert.ToDecimal(userid)
                };
                org = MappingHelper.Mapping(org, mode);

                context.ApdDimOrg.Add(org);
                context.SaveChanges();
                return(fr);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        public FuncResult Delete(string recordid, string userid)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功"
            };

            try
            {
                if (string.IsNullOrWhiteSpace(recordid))
                {
                    fr.IsSuccess = false;
                    fr.Message   = "参数接收异常!";
                    return(fr);
                }

                ApdDimOrg existorg = context.ApdDimOrg.FirstOrDefault(f => f.RecordId.Equals(Convert.ToDecimal(recordid)));
                if (existorg == null)
                {
                    fr.IsSuccess = false;
                    fr.Message   = "未找到企业信息,请确定是否已删除!";
                    return(fr);
                }

                //existorg.LastUpdateDate = DateTime.Now;
                ////existorg.LastUpdatedBy = Convert.ToDecimal(userid);
                //existorg.DeleteFlag = 1;
                //existorg.DeleteDate = DateTime.Now;
                //existorg.DeleteBy = userid;
                context.ApdDimOrg.Remove(existorg);
                context.SaveChanges();

                return(fr);
            }
            catch (Exception)
            {
                throw;
            }
        }