Exemplo n.º 1
0
        public bool AddOrUpdate(tbOrgTLJGCongYe item)
        {
            var dao = new OrgTLJGCongYeDao();

            return(dao.AddOrUpdae(item));

            //var szServices = new DbHelperEfSql<tbOrgTLJGCongYe>();
            //if (item.ID == Guid.Empty)
            //{
            //    item.ID = Guid.NewGuid();
            //    item.CreateDate = DateTime.Now;
            //    item.IsValid = 1;
            //    return szServices.Add(item);
            //}
            //else
            //    return szServices.Update(item, c => c.ID == item.ID);
        }
Exemplo n.º 2
0
        public bool AddOrUpdae(tbOrgTLJGCongYe item)
        {
            try
            {
                var isAdd = true;

                #region
                var query = _context.Set <tbOrgTLJGCongYe>().FirstOrDefault(c => c.ID == item.ID);
                if (query == null)
                {
                    isAdd = true;
                    var model = new tbOrgTLJGCongYe();
                    model.ID             = item.ID;
                    model.OrganizationId = item.OrganizationId;
                    model.WelfareId      = item.WelfareId;
                    model.StaffName      = item.StaffName;
                    model.StaffGender    = item.StaffGender;
                    model.EmployType     = item.EmployType;
                    model.SocialSecurity = item.SocialSecurity;
                    model.Profession     = item.Profession;
                    model.WeiJi          = item.WeiJi;
                    model.SheGong        = item.SheGong;
                    model.QiTa           = item.QiTa;
                    model.HgChiZheng     = item.HgChiZheng;
                    model.HgXueLi        = item.HgXueLi;
                    model.HgNianLing     = item.HgNianLing;
                    model.HgRuZhiNian    = item.HgRuZhiNian;
                    model.HgHuJi         = item.HgHuJi;
                    model.HouQin         = item.HouQin;
                    model.OperateUserID  = item.OperateUserID;
                    model.CreateDate     = item.CreateDate;
                    model.OperateDate    = item.OperateDate;
                    model.IsValid        = item.IsValid;
                    model.Remark         = item.Remark;
                    model.Phone          = item.Phone;
                    model.AddressPlace   = item.AddressPlace;
                    _context.Set <tbOrgTLJGCongYe>().Add(model);
                }
                else
                {
                    isAdd                = false;
                    query.ID             = item.ID;
                    query.OrganizationId = item.OrganizationId;
                    query.WelfareId      = item.WelfareId;
                    query.StaffName      = item.StaffName;
                    query.StaffGender    = item.StaffGender;
                    query.EmployType     = item.EmployType;
                    query.SocialSecurity = item.SocialSecurity;
                    query.Profession     = item.Profession;
                    query.WeiJi          = item.WeiJi;
                    query.SheGong        = item.SheGong;
                    query.QiTa           = item.QiTa;
                    query.HgChiZheng     = item.HgChiZheng;
                    query.HgXueLi        = item.HgXueLi;
                    query.HgNianLing     = item.HgNianLing;
                    query.HgRuZhiNian    = item.HgRuZhiNian;
                    query.HgHuJi         = item.HgHuJi;
                    query.HouQin         = item.HouQin;
                    query.OperateUserID  = item.OperateUserID;
                    query.CreateDate     = item.CreateDate;
                    query.OperateDate    = item.OperateDate;
                    query.IsValid        = 1;
                    query.Remark         = item.Remark;
                    query.Phone          = item.Phone;
                    query.AddressPlace   = item.AddressPlace;
                }
                #endregion

                _context.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageLog.WriteLog(new LogParameterModel()
                {
                    ClassName        = this.GetType().ToString(),
                    MethodName       = "AddOrUpdaeOrgTLJGCongYe",
                    MethodParameters = "添加失败",
                    LogLevel         = ELogLevel.Warn,
                    Message          = ex.Message
                });
                return(false);
            }
        }
Exemplo n.º 3
0
        public bool AddOrUpdate(tbOrgTLJGCongYe item, bool isAdd)
        {
            var szServices = new DbHelperEfSql <tbOrgTLJGCongYe>();

            return(isAdd ? szServices.Add(item) : szServices.Update(item, c => c.ID == item.ID));
        }
Exemplo n.º 4
0
        public JsonResult AddOrUpdate()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.Save;
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            Guid id             = RequestParameters.PGuid("ID");
            Guid ddlOrgID       = RequestParameters.PGuid("ddlOrgID");
            var  StaffName      = RequestParameters.Pstring("StaffName");
            var  StaffGender    = RequestParameters.Pint("StaffGender");
            var  EmployType     = RequestParameters.Pstring("EmployType");
            var  SocialSecurity = RequestParameters.Pstring("SocialSecurity");
            var  Profession     = RequestParameters.Pstring("Profession");
            var  WeiJi          = RequestParameters.Pstring("WeiJi");
            var  SheGong        = RequestParameters.Pstring("SheGong");
            var  QiTa           = RequestParameters.Pstring("QiTa");
            var  HgChiZheng     = RequestParameters.Pstring("HgChiZheng");
            var  HgXueLi        = RequestParameters.Pstring("HgXueLi");
            var  HgNianLing     = RequestParameters.Pstring("HgNianLing");
            var  HgRuZhiNian    = RequestParameters.Pstring("HgRuZhiNian");
            var  HgHuJi         = RequestParameters.Pstring("HgHuJi");
            var  HouQin         = RequestParameters.Pstring("HouQin");
            var  Phone          = RequestParameters.Pstring("Phone");
            var  AddressPlace   = RequestParameters.Pstring("AddressPlace");

            var item = new tbOrgTLJGCongYe();
            item.ID             = id;
            item.OperateDate    = DateTime.Now;
            item.OperateUserID  = Utits.CurrentUserID;
            item.OrganizationId = ddlOrgID;
            item.WelfareId      = ddlOrgID;

            item.StaffName      = StaffName;
            item.StaffGender    = StaffGender;
            item.EmployType     = EmployType;
            item.SocialSecurity = SocialSecurity;
            item.Profession     = Profession;
            item.WeiJi          = WeiJi;
            item.SheGong        = SheGong;
            item.QiTa           = QiTa;
            item.HgChiZheng     = HgChiZheng;
            item.HgXueLi        = HgXueLi;
            item.HgNianLing     = HgNianLing;
            item.HgRuZhiNian    = HgRuZhiNian;
            item.HgHuJi         = HgHuJi;
            item.HouQin         = HouQin;

            item.Phone        = Phone;
            item.AddressPlace = AddressPlace;

            if (item.ID == Guid.Empty)
            {
                ParamState = "1";
                ParamID    = id.ToString();
            }
            else
            {
                ParamState = "2";
                ParamID    = id.ToString();
            }
            var cBll   = new OrgTLJGCongYeBll();
            var isFlag = cBll.AddOrUpdate(item);

            if (isFlag)
            {
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }