protected override void OnFlowEnd(T_I_EngineeringBuildChange EngineeringInfo, S_WF_InsTaskExec taskExec, S_WF_InsDefRouting routing)
        {
            EPCEntities epcentity     = FormulaHelper.GetEntities <EPCEntities>();
            string      EngineeringID = EngineeringInfo.EngineeringID;
            var         model         = epcentity.Set <T_I_EngineeringBuild>().FirstOrDefault(a => a.ID == EngineeringID);

            if (model != null && CurrentUserInfo != null)
            {
                model.Name                       = EngineeringInfo.Name;
                model.CustomerInfo               = EngineeringInfo.CustomerInfo;
                model.CustomerInfoName           = EngineeringInfo.CustomerInfoName;
                model.SerialNumber               = EngineeringInfo.SerialNumber;
                model.ProjectClass               = EngineeringInfo.ProjectClass;
                model.BusinessSector             = EngineeringInfo.BusinessSector;
                model.ProjectStatus              = EngineeringInfo.ProjectStatus;
                model.MarketingMinorsReason      = EngineeringInfo.MarketingMinorsReason;
                model.ProjectLevelDesign         = EngineeringInfo.ProjectLevelDesign;
                model.ProjectLevelContract       = EngineeringInfo.ProjectLevelContract;
                model.ProjectManagementCategory  = EngineeringInfo.ProjectManagementCategory;
                model.Country                    = EngineeringInfo.Country;
                model.Province                   = EngineeringInfo.Province;
                model.City                       = EngineeringInfo.City;
                model.ConstructionSite           = EngineeringInfo.ConstructionSite;
                model.Country                    = EngineeringInfo.Country;
                model.BoxCategory                = EngineeringInfo.BoxCategory;
                model.Province                   = EngineeringInfo.Province;
                model.City                       = EngineeringInfo.City;
                model.IsNeedBid                  = EngineeringInfo.IsNeedBid;
                model.ExpectedTenderDate         = EngineeringInfo.ExpectedTenderDate;
                model.IsNewEnergy                = EngineeringInfo.IsNewEnergy;
                model.NewEnergyType              = EngineeringInfo.NewEnergyType;
                model.AllEstimateInvestmentMoney = EngineeringInfo.AllEstimateInvestmentMoney;
                model.EstimatedContractMoney     = EngineeringInfo.EstimatedContractMoney;
                model.CoverageArea               = EngineeringInfo.CoverageArea;
                model.ConstructionArea           = EngineeringInfo.ConstructionArea;
                model.ConstructionFeatures       = EngineeringInfo.ConstructionFeatures;
                model.WorkshopComposition        = EngineeringInfo.WorkshopComposition;
                model.ConstructionStandard       = EngineeringInfo.ConstructionStandard;
                model.OrganizationResources      = EngineeringInfo.OrganizationResources;
                model.ConstructionMode           = EngineeringInfo.ConstructionMode;
                model.Programme                  = EngineeringInfo.Programme;
                model.ProductOrModels            = EngineeringInfo.ProductOrModels;
                model.Remark                     = EngineeringInfo.Remark;
                model.ProjectManagerLeader       = EngineeringInfo.ProjectManagerLeader;
                // model.IndustryType = EngineeringInfo.IndustryType;
                model.Code              = EngineeringInfo.Code;
                model.CodeName          = EngineeringInfo.CodeName;
                model.IndustryOne       = EngineeringInfo.IndustryOne;
                model.IndustryTwo       = EngineeringInfo.IndustryTwo;
                model.IndustryThree     = EngineeringInfo.IndustryThree;
                model.IndustryFour      = EngineeringInfo.IndustryFour;
                model.IndustryFive      = EngineeringInfo.IndustryFive;
                model.IsImpoartProject  = EngineeringInfo.IsImpoartProject;
                model.ProjectStartTime  = EngineeringInfo.ProjectStartTime;
                model.ProjectEndTime    = EngineeringInfo.ProjectEndTime;
                model.ProjectUpdateTime = EngineeringInfo.ProjectUpdateTime;
                epcentity.SaveChanges();
            }
        }
 //
 // GET: /Manage/DemandTaskNoticeView/
 public JsonResult SetSubsidy(string ids, string val)
 {
     if (!string.IsNullOrEmpty(ids) && !string.IsNullOrEmpty(val))
     {
         ids = ids.Trim(',');
         string[]    strid  = ids.Split(',');
         EPCEntities epcent = FormulaHelper.GetEntities <EPCEntities>();
         var         lists  = epcent.Set <T_I_DemandTaskNotice>().Where(c => ids.Contains(c.ID));
         foreach (T_I_DemandTaskNotice item in lists)
         {
             item.IsSubsidy = val;
         }
         epcent.SaveChanges();
     }
     return(Json(""));
 }
        //
        // GET: /Manage/CustomerClassification/

        protected override void BeforeSave(Dictionary <string, string> dic, S_UI_Form formInfo, bool isNew)
        {
            if (dic != null && dic.ContainsKey("CustomerIDs") && dic.ContainsKey("CustomerClassification"))
            {
                string ids   = dic["CustomerIDs"];
                string value = dic["CustomerClassification"];
                if (!string.IsNullOrEmpty(ids))
                {
                    ids = ids.Trim(',');
                    string[]    eids      = ids.Split(',');
                    EPCEntities epcentity = FormulaHelper.GetEntities <EPCEntities>();
                    var         ctms      = epcentity.Set <S_M_CustomerInfo>().Where(c => eids.Contains(c.ID));
                    foreach (S_M_CustomerInfo item in ctms)
                    {
                        item.CustomerClassification = value;
                    }
                    epcentity.SaveChanges();
                }
            }
        }
        public void AddOrUpdate(string id, string userID, string userName)
        {
            T_C_ConstructionReports_ViewDetails vd = dbContext.T_C_ConstructionReports_ViewDetails.Where(m => m.T_C_ConstructionReportsID == id && m.ViewUserID == userID).FirstOrDefault();

            if (vd != null)
            {
                vd.ViewTime = DateTime.Now;
            }
            else
            {
                T_C_ConstructionReports_ViewDetails newVD = new T_C_ConstructionReports_ViewDetails();
                newVD.ID = FormulaHelper.CreateGuid();
                newVD.T_C_ConstructionReportsID = id;
                newVD.ViewTime     = DateTime.Now;
                newVD.ViewUserID   = userID;
                newVD.ViewUserName = userName;
                dbContext.T_C_ConstructionReports_ViewDetails.Add(newVD);
            }
            dbContext.SaveChanges();
        }
 //如果竞争对手时新增数据 反写竞争对手列表
 protected override void BeforeSaveDetail(Dictionary <string, string> dic, string subTableName, Dictionary <string, string> detail, List <Dictionary <string, string> > detailList, S_UI_Form formInfo)
 {
     if (subTableName == "Competitors")
     {
         string EnterprisenameID = "";
         if (detail.ContainsKey("EnterprisenameID"))
         {
             EnterprisenameID = detail["EnterprisenameID"];
         }
         EPCEntities            epcentity          = FormulaHelper.GetEntities <EPCEntities>();
         var                    Peerinfomanagement = epcentity.Set <S_M_Peerinfomanagement>();
         S_M_Peerinfomanagement model = new S_M_Peerinfomanagement();
         if (string.IsNullOrEmpty(EnterprisenameID))
         {
             model.ID                    = FormulaHelper.CreateGuid();
             model.Name                  = detail["Enterprisename"];
             model.CreateUser            = CurrentUserInfo.UserName;
             model.CreateUserID          = CurrentUserInfo.UserID;
             model.CreateDate            = DateTime.Now;
             model.OrgID                 = CurrentUserInfo.UserOrgID;
             model.CompanyID             = CurrentUserInfo.UserCompanyID;
             model.FlowPhase             = "Start";
             model.ModifyDate            = DateTime.Now;
             model.ModifyUserID          = CurrentUserInfo.UserID;
             model.ModifyUser            = CurrentUserInfo.UserName;
             model.Companyprofile        = detail["Companyprofile"];
             model.Operatingconditions   = detail["Operatingconditions"];
             model.Businessqualification = detail["Businessqualification"];
             model.Technicalability      = detail["Technicalability"];
             model.Projectperformance    = detail["Projectperformance"];
             model.Certificationsystem   = detail["Certificationsystem"];
             Peerinfomanagement.Add(model);
             epcentity.SaveChanges();
         }
     }
 }
        protected override void OnFlowEnd(T_C_CustomerinfoChange CustomerInfo, S_WF_InsTaskExec taskExec, S_WF_InsDefRouting routing)
        {
            EPCEntities epcentity  = FormulaHelper.GetEntities <EPCEntities>();
            string      CustomerID = CustomerInfo.CustomerID;
            var         model      = epcentity.Set <S_M_CustomerInfo>().FirstOrDefault(a => a.ID == CustomerID);

            if (model != null && CurrentUserInfo != null)
            {
                model.Name              = CustomerInfo.Name;
                model.Socialcreditcode  = CustomerInfo.Socialcreditcode;
                model.Highunit          = CustomerInfo.Highunit;
                model.HighunitName      = CustomerInfo.HighunitName;
                model.SimpleName        = CustomerInfo.SimpleName;
                model.Englishname       = CustomerInfo.Englishname;
                model.Usedname1         = CustomerInfo.Usedname1;
                model.Usedname2         = CustomerInfo.Usedname2;
                model.Customersite      = CustomerInfo.Customersite;
                model.Related           = CustomerInfo.Related;
                model.JuridicalPerson   = CustomerInfo.JuridicalPerson;
                model.Registered        = CustomerInfo.Registered;
                model.Registeredcapital = CustomerInfo.Registeredcapital;
                model.Enterprisenature  = CustomerInfo.Enterprisenature;
                model.Industrystatus    = CustomerInfo.Industrystatus;
                model.Setupdate         = CustomerInfo.Setupdate;
                model.Country           = CustomerInfo.Country;
                model.Businesstypes     = CustomerInfo.Businesstypes;
                model.ZipCode           = CustomerInfo.ZipCode;
                model.Province          = CustomerInfo.Province;
                model.City              = CustomerInfo.City;
                model.Primarycontact    = CustomerInfo.Primarycontact;
                model.Contactphone      = CustomerInfo.Contactphone;
                model.Fax               = CustomerInfo.Fax;
                model.Email             = CustomerInfo.Email;
                model.Companyprofile    = CustomerInfo.Companyprofile;
                model.Enterpriseculture = CustomerInfo.Enterpriseculture;
                model.Registrar         = CustomerInfo.Registrar;
                model.RegistrarName     = CustomerInfo.RegistrarName;
                model.Registrationdate  = CustomerInfo.Registrationdate;
                model.InvoiceName       = CustomerInfo.InvoiceName;
                model.TaxAccounts       = CustomerInfo.TaxAccounts;
                model.BankName          = CustomerInfo.BankName;
                model.BankAccounts      = CustomerInfo.BankAccounts;
                model.BankAddress       = CustomerInfo.BankAddress;
                model.Telephone         = CustomerInfo.Telephone;
                model.Attachments       = CustomerInfo.Attachments;
                model.Remark            = CustomerInfo.Attachments;
                model.Businessscope     = CustomerInfo.Businessscope;
                var linkmans = epcentity.Set <S_M_CustomerInfo_LinkMan>().Where(a => a.S_M_CustomerInfoID == CustomerID);
                if (linkmans != null && linkmans.Count() > 0)
                {
                    var listmo = linkmans.ToList();
                    listmo.ForEach(c => {
                        epcentity.Set <S_M_CustomerInfo_LinkMan>().Remove(c);
                    });
                }
                var lkms = CustomerInfo.T_C_CustomerinfoChange_LinkMan;
                if (lkms != null)
                {
                    List <T_C_CustomerinfoChange_LinkMan> listlm = lkms.ToList();
                    foreach (T_C_CustomerinfoChange_LinkMan item in listlm)
                    {
                        S_M_CustomerInfo_LinkMan smclk = new S_M_CustomerInfo_LinkMan();
                        smclk.Name               = item.Name;
                        smclk.Position           = item.Position;
                        smclk.Sex                = item.Sex;
                        smclk.Phone              = item.Phone;
                        smclk.EMail              = item.EMail;
                        smclk.ID                 = FormulaHelper.CreateGuid();
                        smclk.S_M_CustomerInfoID = CustomerID;
                        epcentity.Set <S_M_CustomerInfo_LinkMan>().Add(smclk);
                    }
                }
                epcentity.SaveChanges();
            }
        }