示例#1
0
        public  void CreateFacilityMaster(FacilityMaster facilityMaster)
        {
            facilityMaster.FCID = numberControlMgr.GetFCID(facilityMaster);
            facilityMaster.Status = CodeMaster.FacilityStatus.Create;
            facilityMaster.CurrChargePersonName = genericMgr.FindById<User>(facilityMaster.CurrChargePersonId).FullName;
            genericMgr.Create(facilityMaster);

            #region 记事务
            FacilityTrans facilityTrans = new FacilityTrans();
            facilityTrans.CreateDate = DateTime.Now;
            facilityTrans.CreateUserId = facilityMaster.CreateUserId;
            facilityTrans.CreateUserName = facilityMaster.CreateUserName;
            facilityTrans.EffDate = DateTime.Now.Date;
            facilityTrans.FCID = facilityMaster.FCID;
            facilityTrans.FromChargePersonId = facilityMaster.CurrChargePersonId;
            facilityTrans.FromChargePersonName = facilityMaster.CurrChargePersonName;
            facilityTrans.FromOrganization = facilityMaster.ChargeOrganization;
            facilityTrans.FromChargeSite = facilityMaster.ChargeSite;
            facilityTrans.ToChargePersonId = facilityMaster.CurrChargePersonId;
            facilityTrans.ToChargePersonName = facilityMaster.CurrChargePersonName;
            facilityTrans.ToOrganization = facilityMaster.ChargeOrganization;
            facilityTrans.ToChargeSite = facilityMaster.ChargeSite;
            facilityTrans.TransType = CodeMaster.FacilityTransType.Create;

            facilityTrans.AssetNo = facilityMaster.AssetNo;
            facilityTrans.FacilityName = facilityMaster.Name;
            facilityTrans.FacilityCategory = facilityMaster.Category;
            genericMgr.Create(facilityTrans);
            #endregion


        }
 public string GetFCID(FacilityMaster facilityMaster)
 {
     {
         string numberSuffix = GetNextSequence(BusinessConstants.NUMBERCONTROL_FACILITY);
         numberSuffix = numberSuffix.PadLeft(9, '0');
         return ("FC" + numberSuffix);
     }
 }
        public ActionResult _Edit(FacilityMaster facilityMaster)
        {
            if (ModelState.IsValid)
            {
                facilityMaster.Category = "DZ_SB4";
                facilityMaster.CurrChargePersonName = genericMgr.FindById<User>(facilityMaster.CurrChargePersonId).FullName;
                this.genericMgr.UpdateWithTrim(facilityMaster);
                SaveSuccessMessage(Resources.FMS.FacilityMaster.FacilityMaster_Updated);
            }

          //  return View(facilityMaster);


            TempData["TabIndex"] = 0;
            return new RedirectToRouteResult(new RouteValueDictionary  
                                                   { 
                                                       { "action", "_Edit" }, 
                                                       { "controller", "FacilityMaster" } ,
                                                       { "Id", facilityMaster.FCID }
                                                   });
        }
        public ActionResult New(FacilityMaster facilityMaster)
        {
            if (ModelState.IsValid)
            {
                facilityMaster.Category = "DZ_SB4";
                facilityMgr.CreateFacilityMaster(facilityMaster);
                SaveSuccessMessage(Resources.FMS.FacilityMaster.FacilityMaster_Added);
                return RedirectToAction("Edit/" + facilityMaster.FCID);
            }

            return View(facilityMaster);
        }