protected override void OnFlowEnd(T_Recruitment_Schoolrecruitmentinterview entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            var currentUser = FormulaHelper.GetUserInfo();

            var sentity = new S_E_Recruitment_Schoolrecruitmentinterview()
            {
                ID           = FormulaHelper.CreateGuid(),
                CreateUserID = currentUser.UserID,
                CreateUser   = currentUser.UserName,
                CreateDate   = DateTime.Now,
                T_Recruitment_SchoolrecruitmentinterviewID = entity.ID,

                Major    = string.IsNullOrEmpty(entity.Professional) ? entity.Professional1 : entity.Professional,
                Year     = DateTime.Now.Year,
                Dept     = entity.InterviewDept,
                DeptName = entity.InterviewDeptName,
                IsPass   = entity.IsPass,

                Applicantname        = entity.Applicantname,
                Sex                  = entity.Sex,
                Birth                = entity.Birth,
                Graduateschoolmaster = entity.Graduateschoolmaster,
                Professional         = entity.Professional,
                Graduateschool       = entity.Graduateschool,
                Professional1        = entity.Professional1,
                Graduatetime         = entity.Graduatetime,
                Is211School          = entity.Is211School,
                Is985School          = entity.Is985School,
                Referrer             = entity.Referrer,
                Interviewtime        = entity.Interviewtime,
            };

            BusinessEntities.Set <S_E_Recruitment_Schoolrecruitmentinterview>().Add(sentity);
            BusinessEntities.SaveChanges();
        }
Пример #2
0
        protected override void OnFlowEnd(T_Qualification_PostTotal entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            if (entity == null)
            {
                return;
            }
            var sql     = string.Format("select * from  T_Qualification_Postqualificationmanagement where T_Qualification_PostTotalID ='{0}'", entity.ID);
            var dt      = HRSQLDB.ExecuteDataTable(sql);
            var dicList = FormulaHelper.DataTableToListDic(dt);

            foreach (var item in dicList)
            {
                var userid = item.GetValue("Users");
                var quali  = BusinessEntities.Set <S_Qualification_Postqualificationmanagement>().FirstOrDefault(p => p.Users == userid);
                if (quali == null)
                {
                    quali    = new S_Qualification_Postqualificationmanagement();
                    quali.ID = FormulaHelper.CreateGuid();
                    BusinessEntities.Set <S_Qualification_Postqualificationmanagement>().Add(quali);
                }
                UpdateEntity <S_Qualification_Postqualificationmanagement>(quali, item);
            }
            BusinessEntities.SaveChanges();

            sql = string.Format("update T_Qualification_Postqualificationmanagement set IsApprove='True' where T_Qualification_PostTotalID ='{0}'", entity.ID);
            HRSQLDB.ExecuteNonQuery(sql);
        }
 protected override void BeforeSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew)
 {
     if (isNew)
     {
         dic.SetValue("IsApprove", "False");
     }
     else
     {
         var entity = BusinessEntities.Set <T_Qualification_Postqualificationmanagement>().Find(dic.GetValue("ID"));
         if (entity.IsApprove == "True")
         {
             throw new Exception("当前岗位资格记录已经审批通过,不能修改");
         }
         if (string.IsNullOrEmpty(entity.T_Qualification_PostTotalID))
         {
             return;
         }
         var postTotal = BusinessEntities.Set <T_Qualification_PostTotal>().Find(entity.T_Qualification_PostTotalID);
         if (postTotal != null)
         {
             if (!string.IsNullOrEmpty(postTotal.FlowPhase) && (postTotal.FlowPhase == "End" || postTotal.FlowPhase == "Processing"))
             {
                 throw new Exception("当前岗位资格记录已发起审批,不能修改");
             }
         }
     }
 }
Пример #4
0
        public string Delete(int id)
        {
            int count = (from x in unitOfWork.BusinessEntitiesRepository.Get() where x.BusinessId == id select x.Name).Count();

            if (count > 0)
            {
                var BusinessEntities = new BusinessEntities
                {
                    BusinessId = id
                };
                unitOfWork.BusinessEntitiesRepository.Delete(BusinessEntities);
                if (unitOfWork.Save() == 1)
                {
                    return("Successfully Deleted");
                }
                else
                {
                    return("Delete Failed");
                }
            }
            else
            {
                return("Id is Not Fount");
            }
        }
        protected override void OnFlowEnd(T_Recruitment_Socialrecruitmentemployment entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            var currentUser = FormulaHelper.GetUserInfo();

            var sentity = new S_E_Recruitment_Socialrecruitmentemployment()
            {
                ID           = FormulaHelper.CreateGuid(),
                CreateUserID = currentUser.UserID,
                CreateUser   = currentUser.UserName,
                CreateDate   = DateTime.Now,
                T_Recruitment_SocialrecruitmentemploymentID = entity.ID,

                Major    = entity.Professional,
                Year     = DateTime.Now.Year,
                Dept     = entity.Employmentdept,
                DeptName = entity.EmploymentdeptName,
                IsPass   = entity.IsPass,

                Fillperson     = entity.Fillperson,
                Filldate       = entity.Filldate,
                Candidatename  = entity.Candidatename,
                Position       = entity.Position,
                FillpersonName = entity.FillpersonName,

                Monthlysalary = entity.Monthlysalary,
                Annualsalary  = entity.Annualsalary,
                Pretest       = entity.Pretest,
            };

            BusinessEntities.Set <S_E_Recruitment_Socialrecruitmentemployment>().Add(sentity);
            BusinessEntities.SaveChanges();
        }
        public JsonResult DelCase()
        {
            var ids = GetQueryString("IDs");

            if (string.IsNullOrEmpty(ids))
            {
                return(Json(""));
            }

            var arr = ids.Split(',');

            foreach (var id in arr)
            {
                var caseInfo = BusinessEntities.Set <T_Lawsuit_CaseInformation>().Find(id);

                if (caseInfo != null)
                {
                    BusinessEntities.Set <T_Lawsuit_CaseInformation>().Remove(caseInfo);

                    var fileList = BusinessEntities.Set <T_Lawsuit_CaseFile>().Where(p => p.CaseID == caseInfo.ID);

                    foreach (var file in fileList)
                    {
                        BusinessEntities.Set <T_Lawsuit_CaseFile>().Remove(file);
                    }
                }
            }
            BusinessEntities.SaveChanges();

            return(Json(""));
        }
Пример #7
0
        /// <summary>
        /// Converts a <see cref="BusinessEntities.Student"/> class to a <see cref="Model.Student"/>
        /// class. The BusinessEntities.Student class is referenced by this Business Logic Layer
        /// while the Model.Student class is referenced by the Data Access Layer.
        /// </summary>
        /// <param name="businessStudent">The instance of the BusinessEntities.Student class.</param>
        /// <returns>A corresponding instance of the Model.Student class.</returns>
        public Model.Student ToModel(BusinessEntities.Student businessStudent)
        {
            Model.Student modelStudent = new Model.Student();

            modelStudent.Id = businessStudent.Id;
            modelStudent.Firstname = businessStudent.Firstname;
            modelStudent.Surname = businessStudent.Surname;
            modelStudent.DOB = DateTime.Parse(businessStudent.DOB);
            modelStudent.Course = businessStudent.Course;
            modelStudent.YearOfStudy = (Model.YearOfStudyEnum)businessStudent.YearOfStudy;

            modelStudent.Address = new Model.Address();
            modelStudent.Address.Address1 = businessStudent.Address.Address1;
            modelStudent.Address.Town = businessStudent.Address.Town;
            modelStudent.Address.County = businessStudent.Address.County;
            modelStudent.Address.PostCode = businessStudent.Address.PostCode;

            modelStudent.Contact = new Model.ContactDetail();
            modelStudent.Contact.HomePhone = businessStudent.Contact.HomePhone;
            modelStudent.Contact.MobilePhone = businessStudent.Contact.MobilePhone;
            modelStudent.Contact.HomeEmail = businessStudent.Contact.HomeEmail;
            modelStudent.Contact.StudentEmail = businessStudent.Contact.StudentEmail;

            return modelStudent;
        }
Пример #8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseMvc();


            using (BusinessEntities db = new BusinessEntities())
            {
                bool check = (db.Database.GetService <IDatabaseCreator>() as RelationalDatabaseCreator).Exists();
                if (check)
                {
                    return;
                }
                else
                {
                    db.Database.EnsureCreated();
                }
            }
        }
        public JsonResult GetOfficeList(QueryBuilder qb)
        {
            var nodeFullID = GetQueryString("nodeFullID");
            var applyType  = GetQueryString("ApplyType");

            var useStatus = string.Empty;

            if (applyType == "Add")
            {
                useStatus = "NoUse";
            }

            if (applyType == "Back")
            {
                useStatus = "Use";
            }

            var dept = GetQueryString("DeptID");

            var list = BusinessEntities.Set <T_Logistics_Office>().Where(c => c.Status == "Normal" && c.NodeFullID.StartsWith(nodeFullID));

            if (!string.IsNullOrEmpty(useStatus))
            {
                list = list.Where(p => p.UseStatus == useStatus);
            }

            if (!string.IsNullOrEmpty(dept))
            {
                list = list.Where(p => p.CurrentUseDept == dept);
            }

            var data = list.WhereToGridData(qb);

            return(Json(data));
        }
Пример #10
0
        public JsonResult ImportPackage(string DataSource, string TargetID, string WithUser)
        {
            var list = JsonHelper.ToList(DataSource);
            var wbs  = BusinessEntities.Set <S_W_WBS>().Find(TargetID);

            if (wbs == null)
            {
                throw new Formula.Exceptions.BusinessException("未能找到ID为【" + TargetID + "】的WBS节点,无法导入工作包");
            }
            foreach (var item in list)
            {
                var task = new S_W_TaskWork();
                task.Name = item.GetValue("Name");
                task.Code = item.GetValue("Code");
                if (!String.IsNullOrEmpty(item.GetValue("Workload")))
                {
                    task.Workload = Convert.ToDecimal(item.GetValue("Workload"));
                }
                task.PhaseValue = item.GetValue("PhaseCode");
                task.MajorValue = item.GetValue("MajorCode");
                if (WithUser == true.ToString())
                {
                    task.FillWBSUser(wbs);
                }
                wbs.AddTaskWork(task);
            }
            this.entities.SaveChanges();
            return(Json(""));
        }
Пример #11
0
        /// <summary>
        /// 计算所有项目得分并保存
        /// </summary>
        /// <returns></returns>
        public void CalcScore()
        {
            var lstGrade = BusinessEntities.Set <T_Win_ExpertGrade_AwardItems>().ToList();
            var lstID    = lstGrade.GroupBy(x => x.T_Win_ExpertGradeID).Select(x => x.Key).ToList();

            lstID.ForEach(id =>
            {
                //项目下的所有评分
                var lstItem    = BusinessEntities.Set <T_Win_ExpertGrade_AwardItems>().Where(x => x.T_Win_ExpertGradeID == id).OrderByDescending(x => x.Grade).ToList();
                var scoreModel = BusinessEntities.Set <T_Win_ProjectScore>().FirstOrDefault(x => x.ProjectID == id);
                if (lstItem != null && lstItem.Count > 0)
                {
                    scoreModel.HightScore  = lstItem[0].Grade;
                    scoreModel.LowScore    = lstItem[lstItem.Count - 1].Grade;
                    scoreModel.ExpertCount = lstItem.Count.ToString();

                    lstItem.Remove(lstItem[0]);
                    lstItem.Remove(lstItem[lstItem.Count - 1]);

                    scoreModel.AverageScore = ((lstItem.Sum(x => Convert.ToInt32(x.Grade)) / lstItem.Count) * 1.00).ToString();


                    BusinessEntities.SaveChanges();
                }
            });
        }
        public JsonResult GetCaseFileList(QueryBuilder qb)
        {
            var caseID = GetQueryString("CaseID");
            var data   = BusinessEntities.Set <T_Lawsuit_CaseFile>().Where(p => p.CaseID == caseID).WhereToGridData(qb);

            return(Json(data));
        }
Пример #13
0
        public BusinessEntities ConvertToBusinessEntities()
        {
            BusinessEntities model = new BusinessEntities();

            model.BusinessId     = BusinessId;
            model.Code           = Code;
            model.Email          = Email;
            model.Name           = Name;
            model.Street         = Street;
            model.City           = City;
            model.State          = State;
            model.Zip            = Zip;
            model.Country        = Country;
            model.Mobile         = Mobile;
            model.Phone          = Phone;
            model.ContactPerson  = ContactPerson;
            model.ReferredBy     = ReferredBy;
            model.Logo           = Logo;
            model.Status         = Status;
            model.Balance        = Balance;
            model.CurrentBalance = CurrentBalance;



            model.LoginUrl     = "";
            model.SecurityCode = "";
            model.SMTPServer   = "";
            model.SMTPPort     = 0;
            model.SMTPUsername = "";
            model.SMTPPassword = "";
            model.Deleted      = false;


            return(model);
        }
Пример #14
0
        /// <summary>
        /// 获取合同下已支付金额
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPaymentAmount()
        {
            var number      = GetQueryString("ContractNumber");
            var totalAmount = BusinessEntities.Set <T_Technology_PaymentApply>().Where(x => x.ContractNumber == number && x.FlowPhase == "End").Sum(x => Convert.ToDecimal(x.PaymentAmount));

            return(Json(new { amount = totalAmount }));
        }
Пример #15
0
        protected override void AfterSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew)
        {
            string employeeID = dic.GetValue("EmployeeID");
            var    employee   = BusinessEntities.Set <T_Employee>().Find(employeeID);

            if (employee != null)
            {
                var lastContract = BusinessEntities.Set <T_EmployeeContract>().Where(c => c.EmployeeID == employee.ID).OrderBy("ContractStartDate", false).FirstOrDefault();
                if (lastContract != null)
                {
                    employee.ContractType       = lastContract.ContractCategory;
                    employee.DeterminePostsDate = lastContract.PostDate;
                }
            }

            //只有一个合同生效
            var contractList = BusinessEntities.Set <T_EmployeeContract>().Where(p => p.EmployeeID == employeeID);

            var contractId = dic.GetValue("ID");
            var contract   = BusinessEntities.Set <T_EmployeeContract>().Find(contractId);

            foreach (var item in contractList)
            {
                if (item.ID != contractId)
                {
                    item.IsUseful = "0";
                }
            }

            this.BusinessEntities.SaveChanges();
        }
Пример #16
0
        public Hashtable UpdateAgentInfo(BusinessEntities businessEntityObj)
        {
            Hashtable hashTableObj = new Hashtable();

            try
            {
                if (_modelState.IsValid)
                {
                    var totalUpdatedRecord = _repository.UpdateAgentInfo(businessEntityObj);
                    if (totalUpdatedRecord == 1)
                    {
                        hashTableObj.Add("Success", true);
                        hashTableObj.Add("Message", uiMessages.UpdateSuccess);
                    }
                    else
                    {
                        hashTableObj.Add("Success", false);
                        hashTableObj.Add("Message", uiMessages.UpdateFailed);
                    }
                }
                else
                {
                    hashTableObj.Add("Success", false);
                    hashTableObj.Add("Message", uiMessages.InvalidModel);
                }
                return(hashTableObj);
            }
            catch (Exception)
            {
                hashTableObj.Add("Success", false);
                hashTableObj.Add("Message", exMessages.CommonException);
                return(hashTableObj);
            }
        }
        public JsonResult DeleteNode()
        {
            var fullID = Request["FullID"].ToString();

            if (string.IsNullOrEmpty(fullID))
            {
                return(Json(""));
            }

            if (!fullID.Contains("."))
            {
                throw new BusinessException("不能作废整个位置");
            }

            var poss = this.BusinessEntities.Set <S_E_Logistics_OfficePos>().Where(c => c.FullID.StartsWith(fullID)).ToArray();

            foreach (var pos in poss)
            {
                //取消这个节点下关联的办公室详情
                var list = BusinessEntities.Set <T_Logistics_Office>().Where(p => !string.IsNullOrEmpty(p.NodeFullID) && p.NodeFullID.Contains(pos.ID));

                foreach (var item in list)
                {
                    item.NodeFullID = "";
                    item.NodeID     = "";
                }

                BusinessEntities.Set <S_E_Logistics_OfficePos>().Remove(pos);
            }

            BusinessEntities.SaveChanges();

            return(Json(""));
        }
Пример #18
0
        public void AddApprover(BusinessEntities.ReleasePlan.ReleaseApprover approver)
        {
            var accountExisting = AccountRepository.GetSatisfiedBy(o => o.ExternalId == approver.Account.ExternalId);
            if (accountExisting == null)
            {
                throw new AccountNotFoundException(approver.Account.ExternalId);
            }

            var approval = ReleaseApproverRepository.GetSatisfiedBy(
                o => o.Account.AccountId == accountExisting.AccountId && o.ReleaseWindow.ExternalId == approver.ReleaseWindowId);

            if (approval != null)
                throw new ReleaseApproverDuplicationException(approval.ExternalId);

            var releaseWindow = ReleaseWindowRepository.GetSatisfiedBy(o => o.ExternalId == approver.ReleaseWindowId);
            if (releaseWindow == null)
                throw new ReleaseWindowNotFoundException(approver.ReleaseWindowId);

            ReleaseApproverRepository.Insert(new ReleaseApproverDTO
            {
                AccountId = accountExisting.AccountId,
                ReleaseWindowId = releaseWindow.ReleaseWindowId,
                CreatedOn = SystemTime.Now,
                ExternalId = approver.ExternalId
            });
        }
        /// <summary>
        /// 结果填报情况跟进发送催办
        /// </summary>
        /// <param name="IDs"></param>
        /// <returns></returns>
        public JsonResult SendMsgResult(string IDs)
        {
            if (string.IsNullOrEmpty(IDs))
            {
                throw new Formula.Exceptions.BusinessException("必须选中一行");
            }
            var idArrt = IDs.Split(',');
            var list   = BusinessEntities.Set <S_Train_DeptTask>().Where(p => idArrt.Contains(IDs));
            var msgTmp = @"截止{0},{1}{2}的培训结果仍未全部提交,部门培训负责人为{3},请催办部门培训负责人提交部门培训结果。";
            var title  = "培训计划催办提醒";

            var msgService = FormulaHelper.GetService <IMessageService>();

            foreach (var item in list)
            {
                var sendMsg = string.Format(msgTmp, item.Deadline.Value.ToString("yyyy-MM-dd"), item.DeptName, item.DeptName, item.Trainyears, item.DepttrainleaderName);

                //发送消息给部门领导或者部门主管领导
                if (!string.IsNullOrEmpty(item.Depthead))
                {
                    msgService.SendMsg(title, sendMsg, "", "", item.Depthead, item.DeptheadName);
                }
                else if (!string.IsNullOrEmpty(item.Superiorleader))
                {
                    msgService.SendMsg(title, sendMsg, "", "", item.Superiorleader, item.Superiorleader);
                }
            }
            return(Json(""));
        }
        //
        // GET: /AutoForm/ProtectionArticleReceive/

        protected override void OnFlowEnd(T_ProtectionArticle_Receive entity, Workflow.Logic.Domain.S_WF_InsTaskExec taskExec, Workflow.Logic.Domain.S_WF_InsDefRouting routing)
        {
            if (entity != null)
            {
                //流程结束之后更新库存数量

                var ledgerModel = BusinessEntities.Set <T_ProtectionArticle_Ledger>().FirstOrDefault();
                if (ledgerModel != null)
                {
                    ledgerModel.SafetyHatQuantity   = (Convert.ToInt32(ledgerModel.SafetyHatQuantity) - Convert.ToInt32(entity.SafetyhatReceiveQuantity)).ToString();
                    ledgerModel.SafetyShoesQuantity = (Convert.ToInt32(ledgerModel.SafetyShoesQuantity) - Convert.ToInt32(entity.SafetyShoesReceiveQuantity)).ToString();
                    var lstShoes = BusinessEntities.Set <T_ProtectionArticle_Receive_SafetyShoesDetail>().Where(x => x.T_ProtectionArticle_ReceiveID == entity.ID).ToList();
                    ledgerModel.Size35Quantity = (Convert.ToInt32(ledgerModel.Size35Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size35))).ToString();
                    ledgerModel.Size36Quantity = (Convert.ToInt32(ledgerModel.Size36Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size36))).ToString();
                    ledgerModel.Size37Quantity = (Convert.ToInt32(ledgerModel.Size37Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size37))).ToString();
                    ledgerModel.Size38Quantity = (Convert.ToInt32(ledgerModel.Size38Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size38))).ToString();
                    ledgerModel.Size39Quantity = (Convert.ToInt32(ledgerModel.Size39Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size39))).ToString();
                    ledgerModel.Size40Quantity = (Convert.ToInt32(ledgerModel.Size40Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size40))).ToString();
                    ledgerModel.Size41Quantity = (Convert.ToInt32(ledgerModel.Size41Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size41))).ToString();
                    ledgerModel.Size42Quantity = (Convert.ToInt32(ledgerModel.Size42Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size42))).ToString();
                    ledgerModel.Size43Quantity = (Convert.ToInt32(ledgerModel.Size43Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size43))).ToString();
                    ledgerModel.Size44Quantity = (Convert.ToInt32(ledgerModel.Size44Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size44))).ToString();
                    ledgerModel.Size45Quantity = (Convert.ToInt32(ledgerModel.Size45Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size45))).ToString();
                    ledgerModel.Size46Quantity = (Convert.ToInt32(ledgerModel.Size46Quantity) - lstShoes.Sum(x => Convert.ToInt32(x.Size46))).ToString();
                }

                BusinessEntities.SaveChanges();
            }

            base.OnFlowEnd(entity, taskExec, routing);
        }
        protected override void AfterSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew)
        {
            string employeeID = dic.GetValue("EmployeeID");
            var    employee   = BusinessEntities.Set <T_Employee>().Find(employeeID);

            if (employee != null)
            {
                var ad = BusinessEntities.Set <T_EmployeeAcademicDegree>().Where(c => c.EmployeeID == employee.ID).OrderBy("GraduationDate", false).FirstOrDefault();
                if (ad != null)
                {
                    if (DateTime.Compare((DateTime)ad.GraduationDate, Convert.ToDateTime(dic.GetValue("GraduationDate"))) > 0)
                    {
                        employee.Educational      = ad.Education;
                        employee.EducationalMajor = ad.FirstProfession;
                    }
                    else
                    {
                        employee.Educational      = dic.GetValue("Education");
                        employee.EducationalMajor = dic.GetValue("FirstProfession");
                    }
                }
                else
                {
                    employee.Educational      = null;
                    employee.EducationalMajor = null;
                }
            }
            this.BusinessEntities.SaveChanges();
        }
Пример #22
0
        protected override void BeforeSave(Dictionary <string, string> dic, S_UI_Form formInfo, bool isNew)
        {
            string sql = "select count(0) from S_SP_SupplierContract  where SerialNumber ='{0}' and ID!='{1}'";
            var    obj = this.MarketSQLDB.ExecuteScalar(String.Format(sql, dic.GetValue("SerialNumber"), dic.GetValue("ContractID")));

            if (Convert.ToInt32(obj) > 0)
            {
                throw new Formula.Exceptions.BusinessValidationException("合同编号【" + dic.GetValue("SerialNumber") + "】已经存在,不能重复,请重新编号");
            }
            #region 供应商修改时,要校验是否有发票和付款
            string contractID      = dic.GetValue("ContractID");
            var    oldContract     = BusinessEntities.Set <S_SP_SupplierContract>().Find(contractID);
            string oldSupplierID   = oldContract.Supplier ?? "";
            string oldSupplierName = oldContract.SupplierName ?? "";
            if (BusinessEntities.Set <S_SP_Invoice>().Any(a => a.Supplier == oldSupplierID && a.SupplierContract == contractID) && oldSupplierID != dic.GetValue("Supplier"))
            {
                throw new Formula.Exceptions.BusinessException("供应商【" + oldSupplierName + "】已经有发票登记信息,不能修改供应商");
            }
            else if (BusinessEntities.Set <T_SP_PaymentApply>().Any(a => a.Supplier == oldSupplierID && a.Contract == contractID) &&
                     oldSupplierID != dic.GetValue("Supplier"))
            {
                throw new Formula.Exceptions.BusinessException("付款方【" + oldSupplierName + "】已经有付款申请信息,不能修改供应商");
            }
            else if (BusinessEntities.Set <S_SP_Payment>().Any(a => a.Supplier == oldSupplierID && a.Contract == contractID) &&
                     oldSupplierID != dic.GetValue("Supplier"))
            {
                throw new Formula.Exceptions.BusinessException("付款方【" + oldSupplierName + "】已经有付款信息,不能修改供应商");
            }
            #endregion
        }
Пример #23
0
        public override JsonResult Delete()
        {
            List <T_EXE_DesignChangeApply> list = new List <T_EXE_DesignChangeApply>();

            if (!string.IsNullOrEmpty(Request["ListIDs"]))
            {
                var Ids = Request["ListIDs"].Split(',');
                list.AddRange(this.BusinessEntities.Set <T_EXE_DesignChangeApply>().Where(a => Ids.Contains(a.ID)).ToList());
            }
            if (!string.IsNullOrEmpty(Request["ID"]))
            {
                var id = Request["ID"];
                list.Add(this.BusinessEntities.Set <T_EXE_DesignChangeApply>().FirstOrDefault(a => a.ID == id));
            }
            foreach (var item in list)
            {
                if (!string.IsNullOrEmpty(item.TaskWorkID))
                {
                    var task = this.GetEntityByID <S_W_TaskWork>(item.TaskWorkID);
                    if (task != null)
                    {
                        if (this.BusinessEntities.Set <T_EXE_ChangeAudit>().Any(a => a.WBSID == task.WBSID))
                        {
                            task.ChangeState = TaskWorkChangeState.AuditFinish.ToString();
                        }
                        else
                        {
                            task.ChangeState = string.Empty;
                        }
                    }
                }
                else
                {
                    foreach (var detail in item.T_EXE_DesignChangeApply_TaskWork.ToList())
                    {
                        var _task = this.GetEntityByID <S_W_TaskWork>(detail.TaskWorkID);
                        if (this.BusinessEntities.Set <T_EXE_ChangeAudit>().Any(a => a.WBSID == _task.WBSID))
                        {
                            _task.ChangeState = TaskWorkChangeState.AuditFinish.ToString();
                        }
                        else
                        {
                            _task.ChangeState = string.Empty;
                        }
                    }
                }
            }

            flowService.Delete(Request["ID"], Request["TaskExecID"], Request["ListIDs"]);



            if (BusinessEntities != null)
            {
                BusinessEntities.SaveChanges();
            }

            return(Json(""));
        }
Пример #24
0
        public ActionResult CreateProduct(BusinessEntities.DropDownList ProductCategories, string Name, double MinQuantity, string BtnSubmit)
        {
            BusinessEntities.Product p = new BusinessEntities.Product(Name, ProductCategories.SelectedItemId, MinQuantity);
            BusinessLayer.ProductBusinessLayer l = new BusinessLayer.ProductBusinessLayer();
            l.CreateProduct(p);

            return RedirectToAction("Index");
        }
Пример #25
0
 public Person GetPerson(int id)
 {
     using (BusinessEntities context = new BusinessEntities())
     {
         IQueryable<Person> list = context.Person.Where(x => x.Id == id);
         return list.First();
     }
 }
Пример #26
0
        public void SetPayroll(int payrollID)
        {
            var payroll = new BusinessEntities().Payrolls.Find(payrollID);

            this.Payroll        = payroll;
            this.payroll_id     = payrollID;
            this.payment_amount = payroll.grand_total;
        }
        // GET: /AutoForm/Recruitment_Socialrecruitmentneed/

        public JsonResult GetSocialrecruitmentneedsumList(QueryBuilder qb)
        {
            var year = DateTime.Now.Year;

            var data = BusinessEntities.Set <S_E_Recruitment_DeptRequirementReport_SZRCXQJH>().Where(p => p.Year == year).OrderBy(p => p.Dept);

            return(Json(data));
        }
Пример #28
0
        public void DeleteProduct(BusinessEntities.Product p)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "delete from dbo.Products where ProductId=@ProductId";
            cmd.Parameters.AddWithValue("@ProductId", p.ProductId);

            DBContext.DBContext.Instance.ExecuteNonQuery(cmd);
        }
        public JsonResult DoRetrun()
        {
            var IDs = GetQueryString("IDs");

            BusinessEntities.Set <T_Foreign_Passport>().Where(c => IDs.Contains(c.ID)).Update(c => c.PassportState = "在库");
            BusinessEntities.SaveChanges();
            return(Json(""));
        }
Пример #30
0
        //获取课程进度版本号
        public JsonResult GetProcessCount()
        {
            var id = GetQueryString("ProjectID");

            var iCount = BusinessEntities.Set <T_Technology_ProjectProgress>().Count(x => x.ProjectID == id);

            return(Json(new { Count = iCount }));
        }
Пример #31
0
        protected override void AfterSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew)
        {
            T_Employee employee = BusinessEntities.Set <T_Employee>().Find(dic.GetValue("EmployeeID"));

            if (employee == null)
            {
                throw new Formula.Exceptions.BusinessException("未找到员工对象");
            }
            StringBuilder sql            = new StringBuilder();
            var           currentListStr = dic.GetValue("CurrentJobList");

            if (!string.IsNullOrEmpty(currentListStr))
            {
                var list = JsonHelper.ToList(currentListStr);
                foreach (var item in list)
                {
                    if (item.GetValue("NeedDelete") == "1")
                    {
                        sql.AppendLine(" delete T_EmployeeJob where id='" + item.GetValue("EmployeeJobID") + "'");
                    }
                }
            }
            var changeListStr = dic.GetValue("ChangeJobList");

            if (!string.IsNullOrEmpty(changeListStr))
            {
                var dtField = DbHelper.GetFieldTable(formInfo.ConnName, "T_EmployeeJob").AsEnumerable();
                var list    = JsonHelper.ToObject <List <Dictionary <string, string> > >(changeListStr);
                foreach (var item in list)
                {
                    item.SetValue("EmployeeID", employee.ID);
                    item.RemoveWhere(a => !dtField.Select(b => b.Field <string>("FIELDCODE").ToUpper()).Contains(a.Key.ToUpper()));
                    sql.AppendLine(item.CreateInsertSql(this.HRSQLDB.DbName, "T_EmployeeJob", FormulaHelper.CreateGuid(), dtField));
                }
            }
            if (sql.ToString() != "")
            {
                if (Config.Constant.IsOracleDb)
                {
                    this.HRSQLDB.ExecuteNonQuery(string.Format(@"
                        begin
                        {0}
                        end;", sql));
                }
                else
                {
                    this.HRSQLDB.ExecuteNonQuery(sql.ToString());
                }
            }

            var updateEmployeeBaseDept = GetQueryString("UpdateEmployeeBaseDept");

            if (updateEmployeeBaseDept == "1")
            {
                employee.UpdateDeptByJob();
                this.BusinessEntities.SaveChanges();
            }
        }
Пример #32
0
        public int AddAgent(BusinessEntities businessEntityObj)
        {
            businessEntityObj.CreatedOnUtc = DateTime.Now;
            businessEntityObj.UpdatedOnUtc = DateTime.Now;

            agentContextObj.BusinessEntities.Add(businessEntityObj);

            return(agentContextObj.SaveChanges());
        }
        //
        // GET: /AutoForm/ForeignPassportBorrow/

        protected override void AfterSave(Dictionary <string, string> dic, Base.Logic.Domain.S_UI_Form formInfo, bool isNew)
        {
            if (isNew)
            {
                var PassportID = dic.GetValue("PassportID");
                var Passport   = BusinessEntities.Set <T_Foreign_Passport>().Find(PassportID);
                Passport.PassportState = "借出";
                BusinessEntities.SaveChanges();
            }
        }
Пример #34
0
        public void CreateProductRequestType(BusinessEntities.ProductRequests.ProductRequestType type)
        {
            var existing = ProductRequestTypeRepository.GetSatisfiedBy(o => o.ExternalId == type.ExternalId);
            if (existing != null)
                throw new EntityAlreadyExistsException(typeof(ProductRequestType), type.ExternalId);

            var dataType = MappingEngine.Map<BusinessEntities.ProductRequests.ProductRequestType, ProductRequestType>(type);

            ProductRequestTypeRepository.Insert(dataType);
        }
Пример #35
0
        public void CreateProduct(BusinessEntities.Product p)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "insert into dbo.Products (Name,ProductCategoryId,MinQuantity) values (@Name,@ProductCategoryId,@MinQuantity)";
            cmd.Parameters.AddWithValue("@Name", p.Name);
            cmd.Parameters.AddWithValue("@ProductCategoryId", p.ProductCategoryId);
            cmd.Parameters.AddWithValue("@MinQuantity", p.MinQuantity);

            DBContext.DBContext.Instance.ExecuteNonQuery(cmd);
        }
Пример #36
0
        protected override void BeforeSave(Dictionary <string, string> dic, S_UI_Form formInfo, bool isNew)
        {
            //付款方已经有在开票信息中则不能删除
            if (!isNew)
            {
                Expenses.Logic.BusinessFacade.DataInterfaceFo.ValidateDataSyn("S_C_ManageContract", dic.GetValue("ID"));

                string contractID         = dic.GetValue("ID");
                var    oldContract        = this.BusinessEntities.Set <S_C_ManageContract>().Find(contractID);
                string oldCustomerIDs     = oldContract.PayerUnit ?? "";
                string oldCustomerIDNames = oldContract.PayerUnitName ?? "";

                string customerIDs = dic.GetValue("PayerUnit") ?? "";

                var oldCustomerIDArr   = oldCustomerIDs.Split(',').ToList();
                var oldCustomerNameArr = oldCustomerIDNames.Split(',').ToList();
                for (int i = 0; i < oldCustomerIDArr.Count; i++)
                {
                    string oldCustomerID = oldCustomerIDArr[i];
                    if (!customerIDs.Contains(oldCustomerID))
                    {
                        string customerName = oldCustomerID;
                        if (i < oldCustomerNameArr.Count)
                        {
                            customerName = oldCustomerNameArr[i];
                        }
                        if (BusinessEntities.Set <S_C_Invoice>().Any(a => a.PayerUnitID == oldCustomerID && a.ContractInfoID == contractID))
                        {
                            throw new Formula.Exceptions.BusinessException("付款方【" + customerName + "】已经有开票登记信息,不能删除");
                        }
                        if (BusinessEntities.Set <T_C_InvoiceApply>().Any(a => a.PayerUnit == oldCustomerID && a.Contract == contractID))
                        {
                            throw new Formula.Exceptions.BusinessException("付款方【" + customerName + "】已经有开票申请信息,不能删除");
                        }
                        if (BusinessEntities.Set <S_C_Receipt>().Any(a => a.CustomerID == oldCustomerID && a.ContractInfoID == contractID))
                        {
                            throw new Formula.Exceptions.BusinessException("付款方【" + customerName + "】已经有到款信息,不能删除");
                        }
                    }
                }

                //添加过补充协议的合同状态不能改成登记
                var hasSupp = this.BusinessEntities.Set <S_C_ManageContract_Supplementary>().Any(a => a.ContractInfoID == contractID);
                if (hasSupp && string.IsNullOrEmpty(dic.GetValue("SignDate")))
                {
                    throw new Formula.Exceptions.BusinessException("添加过补充协议的合同必须有签约日期");
                }
            }
            var PaymentDetail = JsonHelper.ToList(dic.GetValue("PaymentDetail"));

            if (PaymentDetail.Count == 0)
            {
                throw new Formula.Exceptions.BusinessException("请选择付款方");
            }
        }
Пример #37
0
        public void UpdateProduct(BusinessEntities.Product p)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "update dbo.Products set Name=@Name,ProductCategoryId=@ProductCategoryId,MinQuantity=@MinQuantity where ProductId=@ProductId";
            cmd.Parameters.AddWithValue("@ProductId", p.ProductId);
            cmd.Parameters.AddWithValue("@Name", p.Name);
            cmd.Parameters.AddWithValue("@ProductCategoryId", p.ProductCategoryId);
            cmd.Parameters.AddWithValue("@MinQuantity", p.MinQuantity);

            DBContext.DBContext.Instance.ExecuteNonQuery(cmd);
        }
Пример #38
0
        public ActionResult DeleteConfirmed(long id)
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();
            BusinessEntities businessentities = db.BusinessEntities.Find(id);

            db.BusinessEntities.Remove(businessentities);
            db.SaveChanges();
            watch.Stop();
            System.Diagnostics.Debug.WriteLine("Execution DeleteConfirmed Total Time: " + watch.ElapsedMilliseconds + "ms");
            return(RedirectToAction("Index"));
        }
Пример #39
0
        public virtual void OnEmployeeSelected(BusinessEntities.Employee employee)
        {
            // We are still using Push based composition here, to show the usage of scoped regionmanagers. 
            // When an employee gets selected, we are creating a new instance of the EmployeeDetailsView and are pushing it in the region. 
            // this would be hard to do with the 'out of the box' functionality of the pull based composition, because we
            // have a requirement where we want to push a view into the region at a specific point in time, and not when
            // the region decides it needs to pull a view into it.

            IRegion detailsRegion = regionManager.Regions[RegionNames.DetailsRegion];
            object existingView = detailsRegion.GetView(employee.EmployeeId.ToString(CultureInfo.InvariantCulture));

            // See if the view already exists in the region. 
            if (existingView == null)
            {
                // the view does not exist yet. Create it and push it into the region
                IEmployeesDetailsPresenter detailsPresenter = this.container.Resolve<IEmployeesDetailsPresenter>();
                detailsPresenter.SetSelectedEmployee(employee);

                // the details view should receive it's own scoped region manager, therefore Add overload using 'true' (see notes below).
                detailsRegion.Add(detailsPresenter.View, employee.EmployeeId.ToString(CultureInfo.InvariantCulture), true);

                detailsRegion.Activate(detailsPresenter.View);
            }
            else
            {
                // The view already exists. Just show it. 
                detailsRegion.Activate(existingView);
            }

            //************************************************************************************************
            // Note on using Scoped Regionmanagers:
            // Scoped regionmanagers are used to have multiple instances of the same region in memory at the same time. 
            // Since a region gets registered with a regionmanager, the name has to be unique. 
            // In this example, we are keeping several instances of the EmployeeDetailsView in memory. Each view has it's own TabRegion, 
            // so each view needs it's own regionmanager. This is still hard to do with pull based composition. 
            //************************************************************************************************

            //************************************************************************************************
            // Note on Push based vs Pull based composition. 
            // Prism V2 is going to support both Push based (V1 style) and Pull based (New in V2) composition. 
            //
            // In pull based composition, as soon as the region get's added to the visual tree, it will be populated with new instances of 
            // registered views. In Pull based composition, you get less control over when views are added (only on load of the region) 
            // but this allows for an easier programming model. 
            //
            // In push based composition, you have to write some code that, at a certain point in time, finds a region that's already
            // created (might not be visible yet) and adds views to it. Using Push based composition, you have more control over when
            // you want to add views to a particular region, but at the expense of more complexity.
            //************************************************************************************************
        }
Пример #40
0
 /// <summary>
 /// Creates a product
 /// </summary>
 /// <param name="productEntity"></param>
 /// <returns></returns>
 public int CreateProduct(BusinessEntities.ProductEntity productEntity)
 {
     using (var scope = new TransactionScope())
     {
         var product = new Product
         {
             ProductName = productEntity.ProductName
         };
         _unitOfWork.ProductRepository.Insert(product);
         _unitOfWork.Save();
         scope.Complete();
         return product.ProductId;
     }
 }
Пример #41
0
    public void Update(Person person)
    {
        using (BusinessEntities context = new BusinessEntities())
        {
            //显示输入新数据的信息
            Display("Current", person);
            var obj = context.Person.Where(x => x.Id == person.Id).First();
            if (obj != null)
                context.ApplyCurrentValues("Person", person);

            //虚拟操作,保证数据能同时加入到上下文当中
            Thread.Sleep(100);
            context.SaveChanges();
        }
    }
Пример #42
0
        public void CreateProductRequestTask(BusinessEntities.ProductRequests.ProductRequestTask task)
        {
            var group = ProductRequestGroupRepository.GetSatisfiedBy(o => o.ExternalId == task.ProductRequestGroupId);
            if (group == null)
                throw new EntityNotFoundException(typeof(ProductRequestGroup), task.ProductRequestGroupId);

            var existing = ProductRequestTaskRepository.GetSatisfiedBy(o => o.ExternalId == task.ExternalId);
            if (existing != null)
                throw new EntityAlreadyExistsException(typeof(ProductRequestTask), task.ExternalId);

            var dataTask = MappingEngine.Map<BusinessEntities.ProductRequests.ProductRequestTask, ProductRequestTask>(task);

            dataTask.ProductRequestGroupId = group.ProductRequestGroupId;

            ProductRequestTaskRepository.Insert(dataTask);
        }
Пример #43
0
        public void CreateProductRequestGroup(BusinessEntities.ProductRequests.ProductRequestGroup @group)
        {
            var type = ProductRequestTypeRepository.GetSatisfiedBy(o => o.ExternalId == @group.ProductRequestTypeId);
            if (type == null)
                throw new EntityNotFoundException(typeof(ProductRequestType), @group.ProductRequestTypeId);

            var existing = ProductRequestGroupRepository.GetSatisfiedBy(o => o.ExternalId == @group.ExternalId);
            if (existing != null)
                throw new EntityAlreadyExistsException(typeof(ProductRequestGroup), @group.ExternalId);

            var dataGroup = MappingEngine.Map<BusinessEntities.ProductRequests.ProductRequestGroup, ProductRequestGroup>(@group);

            dataGroup.ProductRequestTypeId = type.ProductRequestTypeId;

            ProductRequestGroupRepository.Insert(dataGroup);
        }
Пример #44
0
        public void SetState(Guid externalId, BusinessEntities.Evt.EventStateType businessState, string details)
        {
            var dataState = Mapper.Map<BusinessEntities.Evt.EventStateType, EventStateType>(businessState);

            Event Event = EventRepository.GetSatisfiedBy(p => p.ExternalId == externalId);
            if(Event == null)
                throw new EventNotFoundException(externalId);

            var newEntry = new EventHistory
            {
                EventId = Event.EventId,
                State = dataState,
                Details = details
            };

            EventHistoryRepository.Insert(newEntry);
        }
Пример #45
0
        public void CreateRole(BusinessEntities.Auth.Role role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            var existingRole = RoleRepository.GetSatisfiedBy(o => o.ExternalId == role.ExternalId || o.Name == role.Name || o.Description == role.Description);
            if (existingRole != null)
                throw new RoleAlreadyExistsException(role.Name);

            var dataRole = Mapper.Map<BusinessEntities.Auth.Role, Role>(role);
            if (dataRole == null)
                throw new Exception("Can't convert role to data entity");

            Logger.DebugFormat("Creating new role: Role={0}", dataRole);

            RoleRepository.Insert(dataRole);
        }
Пример #46
0
 /// <summary>
 /// Updates a product
 /// </summary>
 /// <param name="productId"></param>
 /// <param name="productEntity"></param>
 /// <returns></returns>
 public bool UpdateProduct(int productId, BusinessEntities.ProductEntity productEntity)
 {
     var success = false;
     if (productEntity != null)
     {
         using (var scope = new TransactionScope())
         {
             var product = _unitOfWork.ProductRepository.GetByID(productId);
             if (product != null)
             {
                 product.ProductName = productEntity.ProductName;
                 _unitOfWork.ProductRepository.Update(product);
                 _unitOfWork.Save();
                 scope.Complete();
                 success = true;
             }
         }
     }
     return success;
 }
Пример #47
0
        public void DeleteRole(BusinessEntities.Auth.Role role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            var existingRole = RoleRepository.GetSatisfiedBy(o => o.ExternalId == role.ExternalId);
            if (existingRole == null)
                throw new RoleNotFoundException(role.ExternalId);

            var accountsAttached = AccountRepository.Entities.Any(o => o.Role.ExternalId == existingRole.ExternalId);
            if (accountsAttached)
                throw new Exception("Can't update role when attached accounts exists");

            //TODO: need to remove this after implemebntation of dynamic roles
            if (existingRole.Id <= 8)
                throw new Exception("Can't change base roles while dynamic permission management not implemented");

            Logger.DebugFormat("Deleting role: Role={0}", role);

            RoleRepository.Delete(existingRole);
        }
Пример #48
0
 /// <summary>
 /// Creates a product
 /// </summary>
 /// <param name="productEntity"></param>
 /// <returns></returns>
 /// For TransactionScope() add using System.Transactions; add reference .Transaction illot allow some of the fields..its only save once we get all datas
 public int CreateProduct(BusinessEntities.ProductEntity productEntity)
 {
     using (var scope = new TransactionScope())
     {
         try
         {
             var product = new Product
             {
                 ProductName = productEntity.ProductName
             };
             _unitOfWork.ProductRepository.Insert(product);
             _unitOfWork.save();
             scope.Complete();
             return product.ProductId;
         }
         catch (Exception ex)
         {
             scope.Dispose();
             throw;
         }
     }
 }
        public virtual void OnEmployeeSelected(BusinessEntities.Employee employee)
        {
            IRegion detailsRegion = regionManager.Regions[RegionNames.DetailsRegion];
            object existingView = detailsRegion.GetView(employee.EmployeeId.ToString(CultureInfo.InvariantCulture));

            if (existingView == null)
            {
                IProjectsListPresenter projectsListPresenter = this.container.Resolve<IProjectsListPresenter>();
                projectsListPresenter.SetProjects(employee.EmployeeId);

                IEmployeesDetailsPresenter detailsPresenter = this.container.Resolve<IEmployeesDetailsPresenter>();
                detailsPresenter.SetSelectedEmployee(employee);

                IRegionManager detailsRegionManager = detailsRegion.Add(detailsPresenter.View, employee.EmployeeId.ToString(CultureInfo.InvariantCulture), true);
                IRegion region = detailsRegionManager.Regions[RegionNames.TabRegion];
                region.Add(projectsListPresenter.View, "CurrentProjectsView");
                detailsRegion.Activate(detailsPresenter.View);
            }
            else
            {
                detailsRegion.Activate(existingView);
            }
        }
Пример #50
0
        public void AddProduct(BusinessEntities.Products.Product product)
        {
            var businessUnit =
                BusinessUnitRepository.GetSatisfiedBy(x => x.ExternalId == product.BusinessUnit.ExternalId);
            if (businessUnit == null)
            {
                throw new EntityNotFoundException(typeof(BusinessUnit), product.BusinessUnit.ExternalId);
            }
            if (ProductRepository.Entities.Any(p => p.ExternalId == product.ExternalId))
            {
                throw new ProductAlreadyExistsException(product.Description);
            }

            var newProduct = new Product
            {
                Description = product.Description,
                ExternalId = product.ExternalId,
                ReleaseTrack = product.ReleaseTrack,
                ChooseTicketsByDefault = product.ChooseTicketsByDefault,
                BusinessUnitId = businessUnit.BusinessUnitId
            };
            ProductRepository.Insert(newProduct);
        }
Пример #51
0
        public void UpdateProductRequestType(BusinessEntities.ProductRequests.ProductRequestType type)
        {
            var existing = ProductRequestTypeRepository.GetSatisfiedBy(o => o.ExternalId == type.ExternalId);
            if (existing == null)
                throw new EntityNotFoundException(typeof(ProductRequestType), type.ExternalId);

            existing.Name = type.Name;

            ProductRequestTypeRepository.Update(existing);
        }
Пример #52
0
        public void UpdateProductRequestTask(BusinessEntities.ProductRequests.ProductRequestTask task)
        {
            var existing = ProductRequestTaskRepository.GetSatisfiedBy(o => o.ExternalId == task.ExternalId);
            if (existing == null)
                throw new EntityNotFoundException(typeof(ProductRequestTask), task.ExternalId);

            existing.Question = task.Question;

            ProductRequestTaskRepository.Update(existing);
        }
Пример #53
0
 public void OnEmployeeSelected(BusinessEntities.Employee employee)
 {
     ShowEmployeeDetailsCalled = true;
 }
Пример #54
0
 public void addVehiculos(BusinessEntities.Vehiculo vehiculo)
 {
     _Context.Vehiculos.Add(vehiculo);
     _Context.SaveChanges();
 }
Пример #55
0
        public void UpdateProduct(BusinessEntities.Products.Product product)
        {
            var businessUnit =
                BusinessUnitRepository.GetSatisfiedBy(x => x.ExternalId == product.BusinessUnit.ExternalId);
            if (businessUnit == null)
            {
                throw new EntityNotFoundException(typeof(BusinessUnit), product.BusinessUnit.ExternalId);
            }
            var existingProduct = ProductRepository.GetSatisfiedBy(x => x.ExternalId == product.ExternalId);

            if (existingProduct == null)
            {
                throw new ProductNotFoundException(product.Description);
            }

            existingProduct.Description = product.Description;
            existingProduct.ChooseTicketsByDefault = product.ChooseTicketsByDefault;
            existingProduct.ReleaseTrack = product.ReleaseTrack;
            existingProduct.BusinessUnitId = businessUnit.BusinessUnitId;
            ProductRepository.Update(existingProduct);
        }
Пример #56
0
        public void updateVehiculo(BusinessEntities.Vehiculo vehiculo)
        {
            _Context.Entry(vehiculo).State = EntityState.Modified;

            _Context.SaveChanges();
        }
Пример #57
0
        public void UpdateProductRequestGroup(BusinessEntities.ProductRequests.ProductRequestGroup @group)
        {
            var existing = ProductRequestGroupRepository.GetSatisfiedBy(o => o.ExternalId == @group.ExternalId);
            if (existing == null)
                throw new EntityNotFoundException(typeof(ProductRequestGroup), @group.ExternalId);

            existing.Name = @group.Name;

            ProductRequestGroupRepository.Update(existing);
        }
        private void RefreshUI(BusinessEntities.Student student)
        {

            //  Bind he form to the student record
            this.StudentEntry.DataContext = student;

            //  Preserve Id of current Item being displayed
            currentDisplayId = student.Id;

            //  refresh the UI components with the student data.
            //this.txtFirstName.Text = student.Firstname;
            //this.txtSurname.Text = student.Surname;
            //this.txtDoB.Text = student.DOB.ToString();
            //this.cbYearOfStudy.SelectedIndex = ((int)student.YearOfStudy - 1);
            //this.txtCourseTitle.Text = student.Course;

            //this.txtAddress.Text = student.Address.Address1;
            //this.txtTown.Text = student.Address.Town;
            //this.txtCounty.Text = student.Address.County;
            //this.txtPostCode.Text = student.Address.PostCode;

            //this.txtPhoneHome.Text = student.Contact.HomePhone;
            //this.txtPhoneMobile.Text = student.Contact.MobilePhone;
            //this.txtEmailHome.Text = student.Contact.HomeEmail;
            //this.txtEmailStudent.Text = student.Contact.StudentEmail;
        }
 public void SetSelectedEmployee(BusinessEntities.Employee employee)
 {
     EmployeesDetailsPresentationModel model = new EmployeesDetailsPresentationModel();
     model.SelectedEmployee = employee;
     this.View.Model = model;
 }
 public void DeleteStudent(BusinessEntities.Student student)
 {
     Helpers helper = new Helpers();
     _repository.DeleteStudent(helper.ToModel(student));
 }