public override void BindToForm(RepositoryBase _extension) { var extension = (GitRepository)_extension; this.EnsureChildControls(); this.txtRemoteRepoPath.Text = extension.RemoteRepositoryUrl; }
public ActionResult GetAccessCode() { var repository = new RepositoryBase<LmPlatformModelsContext, AccessCode>(new LmPlatformModelsContext()); var code = repository.GetAll().OrderBy(e => e.Id).ToList().LastOrDefault(); return Json(code != null ? code.Number : string.Empty, JsonRequestBehavior.AllowGet); }
public static void Init(DataStore dataStore) { Sentences = new SentenceRepository(dataStore, "SentenceText"); Vocabulary = new VocabRepository(dataStore, "Text"); GrammarEntries = new GrammarEntryRepository(dataStore, "Text"); GrammarRoles = new GrammarRolesRepository(dataStore, "RoleName"); Users = new UserRepository(dataStore, "UserID", "Email"); Topics = new TopicRepository(dataStore, "Index", "ToicName"); Sessions = new SessionRepository(dataStore, "UserID"); }
private void Button_Click(object sender, RoutedEventArgs e) { try { var rep = new RepositoryBase<Medico>(); bool novoCadastro = false; if (txtCRM.IsEnabled) { novoCadastro = true; medico = new Medico(); if (txtCPF.Text == "") { MessageBox.Show("Digite um cpf", "Cadastro"); return; } if (txtCRM.Text == "") { MessageBox.Show("Digite um CRM", "Cadastro"); return; } medico.CPF = txtCPF.Text; medico.CRM = txtCRM.Text; } else { medico = rep.Buscar(txtCRM.Text); } medico.Nome = txtNome.Text; medico.Endereco = txtEndereco.Text; medico.Cep = txtCep.Text; medico.Cidade = txtCidade.Text; medico.DataCadastro = DateTime.Now; medico.Numero = txtNumero.Text; medico.Uf = txtUF.Text; if(novoCadastro) rep.Adicionar(medico); else rep.Atualizar(medico); rep.Salvar(); MessageBox.Show("Salvo com sucesso!!", "Cadastro",MessageBoxButton.OK,MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ActionResult GenerateCode() { var repository = new RepositoryBase<LmPlatformModelsContext, AccessCode>(new LmPlatformModelsContext()); var model = new AccessCode() { Date = DateTime.Now, Number = RandomString(10,false) }; repository.Save(model); return Json(model.Number, JsonRequestBehavior.AllowGet); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (crm != "") { var rep = new RepositoryBase<Medico>(); var medico = rep.Buscar(crm); ControleMedico control = new ControleMedico(medico); stkPanel.Children.Add(control); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (ListaGrid.SelectedItem != null) { var item = ListaGrid.SelectedItem; if (item is MedicoGrid) { var medico = (MedicoGrid)item; var crm = medico.CRM; //ListaGrid.SelectedItem.ToString().Split(',')[2].Replace("CRM = ", "").Trim(); var result = MessageBox.Show("Deseja excluir o item " + crm, "Excluir", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { var rep = new RepositoryBase<Medico>(); rep.Remover(x => x.CRM == crm); rep.Salvar(); MessageBox.Show("Removido com sucesso", "Excluir"); ShareList.Remove(ShareList.Where(x => x.CRM==crm).FirstOrDefault()); } } } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false); var config = builder.Build(); TokenSettings = config.GetSection("token").Get <TokenSettings>(); TokenSettings.SigningCredentials = new SigningCredentials( new SymmetricSecurityKey(Encoding.ASCII.GetBytes(TokenSettings.Key)), SecurityAlgorithms.HmacSha256Signature); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); builder.AddUserSecrets <Startup>(); } app.UseAuthentication(); app.UseCors(c => c.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.Use((context, next) => { if (context.Request.GetUri().AbsoluteUri.Contains("localhost")) { if (DatabaseSettings == null) { DatabaseSettings = new DatabaseSettings(); config.GetSection("db:test").Bind(DatabaseSettings); DatabaseSettings.MainConnectionString = config.GetSection("db:test:ConnectionString").Value; } var testDb = $"{DatabaseSettings.ConnectionString.Split("=")[1]}"; if (!File.Exists(testDb)) { SQLiteConnection.CreateFile(testDb); var script = File.ReadAllText(DatabaseSettings.Scripts.Main); RepositoryBase.RunScript(script, DatabaseSettings.ConnectionString); } } return(next()); }); app.Use((context, next) => { string authorization = context.Request.Headers["Authorization"]; if (string.IsNullOrEmpty(authorization)) { return(next()); } if (authorization.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)) { authorization = authorization.Substring("Bearer ".Length).Trim().Replace("\"", string.Empty); } var handler = new JwtSecurityTokenHandler(); var token = handler.ReadJwtToken(authorization); if (token == null) { context.Response.StatusCode = (int)HttpStatusCode.Unauthorized; return(next()); } var service = (IAccountService)app.ApplicationServices.GetService(typeof(IAccountService)); var vendor = service.GetVendorFromToken(token.Payload.Jti); if (vendor != null) { var format = config.GetSection("db:db-vendor:ConnectionString").Value; DatabaseSettings.ConnectionString = string.Format(format, vendor.Name); DatabaseSettings.Admin = true; } return(next()); }); app.Use((context, next) => { string vendor; if (context.Request.Query.ContainsKey("vendor") && !string.IsNullOrEmpty(vendor = context.Request.Query["vendor"].ToString())) { var format = config.GetSection("db:db-vendor:ConnectionString").Value; DatabaseSettings.VendorName = vendor; DatabaseSettings.ConnectionString = string.Format(format, vendor); DatabaseSettings.Admin = false; } return(next()); }); app.UseMvc(); //.Run(async (context) => { await context.Response.WriteAsync("Hello World!"); }); }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { RepositoryBase.ClearTrans(); base.OnActionExecuting(filterContext); SecurityHelper.CreateTicket(this.Request, this.Response, DateTime.Now.AddMinutes(30)); }
public override void Refresh(string jsonPayload) { var payloads = DeserializeFromJsonPayload(jsonPayload); payloads.ForEach(payload => { GetCacheKeysForAlias(payload.Alias).ForEach( alias => ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(alias)); ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey <IMacro>(payload.Id)); }); base.Refresh(jsonPayload); }
public void SubmitForm(ProfileScoreCriteria_ClassifyEntity entry, string groupId, string[] typeIds) { using (var db = new RepositoryBase().BeginTrans()) { if (!string.IsNullOrEmpty(groupId)) { //查出之前的小类 var classifysEntitys = db.IQueryable <ProfileScoreCriteria_ClassifyEntity>().Where(d => d.GroupId == groupId).ToList(); //查找是否存在差异 存在改删除的就删除 改修改的就修改 //要删除的 var deleteTypes = classifysEntitys.Select(d => d.STypeId).Except(typeIds).ToList(); //新增的 var insertTypes = typeIds.Except(classifysEntitys.Select(d => d.STypeId)).ToList(); //处理要是删除的集合 foreach (var item in deleteTypes) { var classifyEntity = classifysEntitys.FirstOrDefault(d => d.STypeId == item); //查找评分明细的数据 var queryNorm = db.IQueryable <ProfileScireCriteria_NormEntity>().Where(d => d.SClassifyId == classifyEntity.SClassifyId); if (queryNorm.Count() > 0) { db.Delete <ProfileScireCriteria_NormEntity>(queryNorm.FirstOrDefault()); } //删除当前关联 取消的type(一级道路,特技道路) db.Delete <ProfileScoreCriteria_ClassifyEntity>(classifyEntity); //删除查询数组当中 classifysEntitys.Remove(classifyEntity); } //当前关联小类评分评分标准第一项 ProfileScireCriteria_NormEntity fistNormEntity = null; string sClassifyId = classifysEntitys[0].SClassifyId; //查看当前类下是否关联了评分标准 var queryInsertNorm = db.IQueryable <ProfileScireCriteria_NormEntity>().Where(d => d.SClassifyId == sClassifyId); if (queryInsertNorm.Count() > 0) { fistNormEntity = queryInsertNorm.FirstOrDefault(); } ProfileScoreCriteria_ClassifyEntity insertClassifyEntity = null; ProfileScireCriteria_NormEntity insertNormEntity = null; //处理新增的 foreach (var item in insertTypes) { insertClassifyEntity = new ProfileScoreCriteria_ClassifyEntity() { GroupId = classifysEntitys[0].GroupId, SClassifyName = entry.SClassifyName, Score = entry.Score, STypeId = item, SClassifyId = Guid.NewGuid().ToString() }; db.Insert <ProfileScoreCriteria_ClassifyEntity>(insertClassifyEntity); //如果当前小类下有关联则每个小类上都关联上 if (fistNormEntity != null) { insertNormEntity = new ProfileScireCriteria_NormEntity() { GroupId = fistNormEntity.GroupId, SClassifyId = insertClassifyEntity.SClassifyId, Condition = fistNormEntity.Condition, SNormProjectName = fistNormEntity.SNormProjectName, SNormStandardName = fistNormEntity.SNormStandardName, SNormId = Guid.NewGuid().ToString() }; db.Insert <ProfileScireCriteria_NormEntity>(insertNormEntity); } } //修改 foreach (var item in classifysEntitys) { item.SClassifyName = entry.SClassifyName; item.Score = entry.Score; db.Update <ProfileScoreCriteria_ClassifyEntity>(item); } } else { ProfileScoreCriteria_ClassifyEntity addModel = null; string newGroupId = Guid.NewGuid().ToString(); foreach (var item in typeIds) { addModel = new ProfileScoreCriteria_ClassifyEntity(); //每一个classify只能对应一个Tyoeids 添加多个 addModel = new ProfileScoreCriteria_ClassifyEntity() { SClassifyId = Guid.NewGuid().ToString(), SClassifyName = entry.SClassifyName, Score = entry.Score, STypeId = item, GroupId = newGroupId }; db.Insert <ProfileScoreCriteria_ClassifyEntity>(addModel); } } db.Commit(); } }
private async Task CreatePaymentDetails(Payment payment) { if (payment == null) { throw new ArgumentNullException("payment"); } await Task.Run(() => { bool isFirstLine = true; RepositoryBase <FamilyMember> familyMemberRepos = _unitOfWork.FamilyMembers; RepositoryBase <PaymentSequence> sequRepos = _unitOfWork.PaymentSequences; RepositoryBase <PeriodSetting> periodRepos = _unitOfWork.PeriodSettings; RepositoryBase <PaymentStatus> payStatusRepos = _unitOfWork.PaymentStatuses; RepositoryBase <PaymentStatus> paymRepos = _unitOfWork.PaymentStatuses; PaymentSequence paySequ = payment.PaymentSequence; PeriodSetting currentYear = payment.PeriodSetting; RepositoryBase <PaymentTransaction> detailsRepos = _unitOfWork.PaymentTransactions; int counter = 0; //Start: _uiLoansHistory.Clear(); List <FamilyMember> eligibleMembers = GetEligibleMembers(); //List<LoansHistory> tempLoansHistory = new List<LoansHistory>(); foreach (FamilyMember familyMember in eligibleMembers) { isFirstLine = true; decimal memberLoansPayment = 0.0M; PaymentTransaction detail = CreateMemberDetail(payment, familyMember); #region "Old" //detail.DetailNo = Guid.NewGuid(); //detail.PaymentNo = payment.PaymentNo; //detail.FamilyMember = familyMember; //detail.ShareNumbers = familyMember.Shares; #endregion List <Loan> memberLoans = GetMemberLoans(payment, familyMember); foreach (Loan loan in memberLoans) { #region "Old" //var order = GetLoanOrder(payment, loan); //if (order == null) throw new InvalidOperationException("You must register payment orders for all types of loans"); //paymentAmountDue = PayMemberLoans(detail, tempLoansHistory, familyMember, paymentAmountDue, loan, order); #endregion memberLoansPayment += PayLoan(loan, detail); } detail.AmountDue = memberLoansPayment; detail.NetPayments = detail.NetPayments - detail.AmountDue; //((payment.Amount * detail.ShareNumbers) - detail.AmountDue); detailsRepos.Add(detail); var progMeta = new Tuple <double, double, string>(counter, eligibleMembers.Count, familyMember.FullName); ShowData(detail, isFirstLine, progMeta); #region "Old algorithm " //if (holderLoans.Count == 0) //{ // //******* Warning: Get an official confirmation for this policy.********// // // If no loans found; either this ShareHolder has no loans completely, // //or has no loans for just this payment. // //and in the latter, we will retrive all INPAYING loans. // holderLoans = loansRepos.Query // ( // x => x.ShareHolder.Code == sharHolder.Code && // x.StatusId == 2 // ).ToList(); //} //decimal paymentAmountDue = 0.0M; //if (holderLoans.Count() > 0) //If no loans, terminate. //{ // //Get the payment orders of this payment. // var paymentOrders = ordersRepos.Query(x => x.Payment.PaymentNo == payment.PaymentNo); // foreach (var loan in holderLoans) // { // decimal tempAmountDue = 0.0M; // //Get the admin order regrad this specific loan. // var order = paymentOrders.Where(x => x.LoanType.Code == loan.LoanType.Code).SingleOrDefault(); // if (order != null) // { // tempAmountDue = (loan.Amount * order.EarnPercent) / 100; // paymentAmountDue += (loan.Amount * order.EarnPercent) / 100; // } // else // { // tempAmountDue = loan.Amount; // paymentAmountDue += loan.Amount; // } // loan.Paid = tempAmountDue; // loan.Balance = loan.Amount - loan.Paid; // } // //amountDue = holderLoans.Sum(x => x.Amount); //} #endregion counter++; } PaymentStatus status = payStatusRepos.GetById(2); //Under Review Status. payment.PaymentStatus = status; } ); }
public DepartamentoServices(RepositoryBase DepartamentoServices) { _departamentoServices = DepartamentoServices; }
public Task SyncAsync() { Task tsk = Task.Run(() => { string contsYear = _contractYear.Substring(2, 2); RepositoryBase <Contract> contractRepository = _unitOfWork.Contracts; var sgeContracts = contractRepository.GetAll(); var irsContracts = new ContractTableAdapter(Properties.Settings.Default.IrsDbPath, contsYear).GetData(); double count = irsContracts.Count; double current = 0.0; foreach (Contract irsContract in irsContracts) { bool exist = sgeContracts.Any(contr => contr.ContractNo == irsContract.ContractNo); if (!exist) //If new Add it { Contract newSgeContract = new Contract() { ContractNo = irsContract.ContractNo, StartDate = irsContract.StartDate, EndDate = irsContract.EndDate, CustomerId = irsContract.CustomerId, PropertyNo = irsContract.PropertyNo, Closed = irsContract.Closed, AgreedRent = irsContract.AgreedRent, RentDue = irsContract.RentDue, AgreedDeposit = irsContract.AgreedDeposit, AgreedMaintenance = irsContract.AgreedMaintenance, RentBalance = irsContract.RentBalance, MaintenanceBalance = irsContract.MaintenanceBalance, DepositBalance = irsContract.DepositBalance, Total = irsContract.RentBalance + irsContract.MaintenanceBalance + irsContract.DepositBalance, //Set scheduled to false initially Scheduled = false, }; contractRepository.Add(newSgeContract); } else //Otherwise udpate it. { var existingContract = sgeContracts.Single(x => x.ContractNo == irsContract.ContractNo); existingContract.StartDate = irsContract.StartDate; existingContract.EndDate = irsContract.EndDate; existingContract.CustomerId = irsContract.CustomerId; existingContract.PropertyNo = irsContract.PropertyNo; existingContract.Closed = irsContract.Closed; existingContract.AgreedRent = irsContract.AgreedRent; existingContract.RentDue = irsContract.RentDue; existingContract.AgreedDeposit = irsContract.AgreedDeposit; existingContract.AgreedMaintenance = irsContract.AgreedMaintenance; existingContract.RentBalance = irsContract.RentBalance; existingContract.MaintenanceBalance = irsContract.MaintenanceBalance; existingContract.DepositBalance = irsContract.DepositBalance; existingContract.Total = irsContract.RentBalance + irsContract.MaintenanceBalance + irsContract.DepositBalance; existingContract.Closed = irsContract.Closed; bool contractHadScheduled = existingContract.ScheduleDetails.Count > 0; existingContract.Scheduled = contractHadScheduled; } current++; double progress = (current / count) * 100; RaiseProgress(progress); } //Now determine the closed contracts in IRS db and update their counterparts in SGE db. //foreach (var sgeContract in sgeContracts) //{ // //From SGE to IRS, same process as above but the other way round. // bool exist = irsContracts.Any(contr => contr.ContractNo == sgeContract.ContractNo); // if (!exist) //Only if the contract is missing from data coming from IRS db, that is an evidence for closed contract. // { // sgeContract.Closed = true; // } //} }); return(tsk); }
public IEnumerable <Slide> GetSlides() { return(RepositoryBase <Slide> .GetMulti(x => x.Status)); }
public SysConfig GetSysConfig(string Id) { return(RepositoryBase <SysConfig> .GetSingleByCondition(x => x.Id == Id)); }
public Footer GetFooter() { return(RepositoryBase <Footer> .GetSingleByCondition(x => x.Id == CommonConstants.DefaultFooterId)); }
public DanbooruServiceImpl(RepositoryBase repository) { _repository = repository; }
public ActionResult LaunchBranchAssessment(string assessment_name, string start_time, string end_time, string templete_id, string checker_list, string filling_people, string file_name) { if (assessmentApp.IsExists(assessment_name)) { return(Error("考核名称已存在。")); } using (var db = new RepositoryBase().BeginTrans()) { //获取“中安金控集团id” OrganizeEntity org = organizeApp.GetForm(BlocId); //获取所有子公司 List <OrganizeEntity> branchList = organizeApp.GetListByParentIdOrderById(org.F_Id, CompanyId); List <BranchAssessmentCheckerModel> checkerList = KPI.Code.Json.ToObject <List <BranchAssessmentCheckerModel> >(checker_list); #region 插入考核发起表 AssessmentEntity assessmentEntity = new AssessmentEntity(); string assessmentId = Common.GuId(); assessmentEntity.id = assessmentId; assessmentEntity.assessment_name = assessment_name; assessmentEntity.templete_id = templete_id; assessmentEntity.start_time = DateTime.Parse(start_time); assessmentEntity.end_time = DateTime.Parse(end_time); assessmentEntity.assessment_sponsor = OperatorProvider.Provider.GetCurrent().UserId; assessmentEntity.assessment_count = branchList.Count; assessmentEntity.assessment_statue = 0; assessmentEntity.assessment_type = 1; assessmentEntity.filing_people = filling_people; assessmentEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentEntity.create_time = DateTime.Now; db.Insert <AssessmentEntity>(assessmentEntity); #endregion #region 插入考核发起详细表 AssessmentDetailEntity assessmentDetailEntity = new AssessmentDetailEntity(); for (int i = 0; i < checkerList.Count; i++) { for (int j = 0; j < branchList.Count; j++) { BranchAssessmentCheckerModel checker = checkerList[i]; OrganizeEntity check_object = branchList[j]; assessmentDetailEntity = new AssessmentDetailEntity(); assessmentDetailEntity.id = Common.GuId(); assessmentDetailEntity.assessment_id = assessmentId; assessmentDetailEntity.check_object = check_object.F_Id; assessmentDetailEntity.checker = checker.checker_id; assessmentDetailEntity.check_order = checker.checker_order; assessmentDetailEntity.finished = 0; assessmentDetailEntity.checker_weight = 0; assessmentDetailEntity.check_total_count = checkerList.Count; assessmentDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentDetailEntity.create_time = DateTime.Now; db.Insert <AssessmentDetailEntity>(assessmentDetailEntity); //给所有“考评人”插入考评任务并且激活第一个考评人的任务 SelfTaskDetailEntity selfTaskDetailEntity = new SelfTaskDetailEntity(); selfTaskDetailEntity.id = Common.GuId(); if (checker.checker_order == 1)//第一个人直接激活任务 { selfTaskDetailEntity.task_statue = 1; } else //剩下的人暂时先不激活任务,等待上一个人完成任务后激活下一个人的任务 { selfTaskDetailEntity.task_statue = 0; } selfTaskDetailEntity.task_type = 1; selfTaskDetailEntity.person = checker.checker_id; selfTaskDetailEntity.task_object = check_object.F_Id; selfTaskDetailEntity.attach = assessmentId; selfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; selfTaskDetailEntity.create_time = DateTime.Now; db.Insert <SelfTaskDetailEntity>(selfTaskDetailEntity); } } //给“考核结果审核人插入归档任务” SelfTaskDetailEntity fillingSelfTaskDetailEntity = new SelfTaskDetailEntity(); fillingSelfTaskDetailEntity.id = Common.GuId(); fillingSelfTaskDetailEntity.task_statue = 0; fillingSelfTaskDetailEntity.task_type = 4; fillingSelfTaskDetailEntity.person = filling_people; fillingSelfTaskDetailEntity.task_object = assessmentId; fillingSelfTaskDetailEntity.attach = assessmentId; fillingSelfTaskDetailEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; fillingSelfTaskDetailEntity.create_time = DateTime.Now; db.Insert <SelfTaskDetailEntity>(fillingSelfTaskDetailEntity); //导入考核数据 BranchAssessmentImportApp branchAssessmentImportApp = new BranchAssessmentImportApp(db); var data = branchAssessmentImportApp.Scan(file_name, new string[] { assessmentId }); if (data.Count > 0) { return(Error("导入数据存在未处理的错误!")); } else { branchAssessmentImportApp.Import(file_name, assessmentId); } db.Commit(); } #endregion return(Success("操作成功。", null)); }
public ConsultaUsuario() { InitializeComponent(); repositoryBase = new RepositoryBase <Usuario>(new DAL.Contexto()); }
public Task SyncAsync() { Task tsk = Task.Run( () => { string paysYear = _paymentYear.Substring(2, 2); RepositoryBase <Payment> paymentRepository = _unitOfWork.Payments; var sgePayments = paymentRepository.GetAll(); var irsPayments = new PaymentTableAdapter(Properties.Settings.Default.IrsDbPath, paysYear).GetData(); double count = irsPayments.Count; double current = 0.0; foreach (Payment irsPayment in irsPayments) { bool exist = sgePayments.Any(p => p.PaymentNo == irsPayment.PaymentNo); if (!exist) //If new Add it { Payment newSgePayment = new Payment() { PaymentNo = irsPayment.PaymentNo, AccountNo = irsPayment.AccountNo, ContractNo = irsPayment.ContractNo, Renewal = irsPayment.Renewal, Name = irsPayment.Name, PayDate = irsPayment.PayDate, PaymentType = irsPayment.PaymentType, PaymentFor1 = irsPayment.PaymentFor1, PaymentFor2 = irsPayment.PaymentFor2, TotalPayment = irsPayment.TotalPayment, Rent = irsPayment.Rent, Deposit = irsPayment.Deposit, Maintenance = irsPayment.Maintenance, Others = irsPayment.Others, Posted = irsPayment.Posted, DebitAccount = irsPayment.DebitAccount, PayCode = irsPayment.PayCode, }; paymentRepository.Add(newSgePayment); } else //Otherwise udpate it. { var existingPayment = sgePayments.Single(p => p.PaymentNo == irsPayment.PaymentNo); existingPayment.AccountNo = irsPayment.AccountNo; existingPayment.ContractNo = irsPayment.ContractNo; existingPayment.Renewal = irsPayment.Renewal; existingPayment.Name = irsPayment.Name; existingPayment.PayDate = irsPayment.PayDate; existingPayment.PaymentType = irsPayment.PaymentType; existingPayment.PaymentFor1 = irsPayment.PaymentFor1; existingPayment.PaymentFor2 = irsPayment.PaymentFor2; existingPayment.TotalPayment = irsPayment.TotalPayment; existingPayment.Rent = irsPayment.Rent; existingPayment.Deposit = irsPayment.Deposit; existingPayment.Maintenance = irsPayment.Maintenance; existingPayment.Others = irsPayment.Others; existingPayment.Posted = irsPayment.Posted; existingPayment.DebitAccount = irsPayment.DebitAccount; existingPayment.PayCode = irsPayment.PayCode; } current++; double progress = (current / count) * 100; RaiseProgress(progress); } } ); return(tsk); }
public ActionResult CheckAssessment(string assessment_id, string check_object, double?fixed_score, double?unfixed_score, double?toatal_score, double?checker_weight) { using (var db = new RepositoryBase().BeginTrans()) { string checker = OperatorProvider.Provider.GetCurrent().UserId; // AssessmentDetailEntity assessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckerCheckObj(assessment_id, checker, check_object); assessmentDetailEntity.finished = 1; assessmentDetailEntity.last_modify_time = DateTime.Now; db.Update <AssessmentDetailEntity>(assessmentDetailEntity); //保存此考核人对此考核对象的分数 AssessmentResultCountEntity assessmentResultCountEntity = new AssessmentResultCountEntity(); assessmentResultCountEntity.id = Common.GuId(); assessmentResultCountEntity.assessment_id = assessment_id; assessmentResultCountEntity.checker = checker; assessmentResultCountEntity.checker_weight = checker_weight; assessmentResultCountEntity.check_object = check_object; assessmentResultCountEntity.fixed_score = fixed_score; assessmentResultCountEntity.unfixed_score = unfixed_score; assessmentResultCountEntity.total_score = fixed_score + unfixed_score; assessmentResultCountEntity.creator_user_id = OperatorProvider.Provider.GetCurrent().UserId; assessmentResultCountEntity.create_time = DateTime.Now; db.Insert <AssessmentResultCountEntity>(assessmentResultCountEntity); //更新自己的考核任务为已完成 SelfTaskDetailEntity curTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, checker, check_object, 1); curTaskDetailEntity.task_statue = 2; curTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(curTaskDetailEntity); //如果自己不是该考核对象的最后一个考核人激活下一个人对该考核对象的任务 if (!assessmentDetailApp.IsLastCheckerToObject(assessment_id, checker, check_object)) { int nextCheckOrder = assessmentDetailEntity.check_order + 1; AssessmentDetailEntity nextAssessmentDetailEntity = assessmentDetailApp.GetByAssessmentIdCheckOrderCheckObj(assessment_id, check_object, nextCheckOrder); SelfTaskDetailEntity curSelfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachPersonTaskObjTaskType(assessment_id, nextAssessmentDetailEntity.checker, check_object, 1); //激活任务 curSelfTaskDetailEntity.task_statue = 1; curSelfTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(curSelfTaskDetailEntity); } //如果是整个考核的最后一条 if (assessmentDetailApp.IsLastChecker(assessment_id))//如果是最后一个人对最后一个对象考核 { //更新整个考核为待归档 AssessmentEntity assessmentEntity = assessmentApp.GetForm(assessment_id); if (assessmentEntity == null) { return(Error("系统未知错误。")); } assessmentEntity.assessment_statue = 1; assessmentEntity.last_modify_time = DateTime.Now; db.Update <AssessmentEntity>(assessmentEntity); //激活“考核结果审核人”的归档任务 SelfTaskDetailEntity selfTaskDetailEntity = selfTaskDetailApp.GetByPersonAttachTaskObjTaskType(assessment_id, assessment_id, 4); selfTaskDetailEntity.task_statue = 1; selfTaskDetailEntity.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(selfTaskDetailEntity); } db.Commit(); } return(Success("操作成功。", null)); }
/// <summary> /// 保存操作 /// </summary> /// <param name="entity">entity</param> /// <param name="keyValue">key</param> public AddOrderResponse AddOrder(OrderViewModel model) { AddOrderResponse addOrderResponse = new AddOrderResponse(); using (var db = new RepositoryBase().BeginTrans()) { //添加患者信息 MemberEntity memberEntity = new MemberEntity(); memberEntity.CredentialInformation = model.CredentialInformation; memberEntity.CredentialType = (int)model.CredentialType; memberEntity.FullName = model.FullName; memberEntity.VisitingCardNumber = model.VisitingCardNumber; memberEntity.Gender = (int)model.Gender; memberEntity.DateOfBirth = model.DateOfBirth; memberEntity.ContactNumber = model.ContactNumber; memberEntity.Email = model.Email; memberEntity.Nationality = model.Nationality; //验证用户是否存在,如果存在不进行添加 var member = db.IQueryable <MemberEntity>(item => item.CredentialInformation == memberEntity.CredentialInformation && item.CredentialType == memberEntity.CredentialType).FirstOrDefault(); if (member == null) { db.Insert(memberEntity); } //添加预约信息 OrderEntity orderEntity = new OrderEntity(); orderEntity.OrderDoctorId = model.OrderDoctorId; orderEntity.OrderDate = orderEntity.OrderDate; orderEntity.OrderType = orderEntity.OrderType; orderEntity.Category = (OrderTimeTypeEnum)orderEntity.OrderType; orderEntity.MemberId = memberEntity.MemberId; orderEntity.SymptomDescription = model.SymptomDescription; //周几 var week = (int)model.OrderDateTime.DayOfWeek; if (week == 0) { week = 7; } //判断是否预约已经满 //剩余预约数量 int remainOrderCount = 0; //出诊信息 var linq = db.IQueryable <VisitEntity>(item => item.DoctorId == model.OrderDoctorId && item.Week == week); //依次预约 if (model.OrderType == OrderTypeEnum.Successively) { orderEntity.NumberType = (int)OrderTypeEnum.Successively; orderEntity.BeginTime = null; orderEntity.EndTime = null; orderEntity.OrderNumber = DateTime.Now.ToString("yyyyMMddHHmmssfff"); switch (model.OrderDateTimeType) { case OrderTimeTypeEnum.Morning: { var orderTimetype = (int)OrderTimeTypeEnum.Morning; //查询已预约数量 var orderedCount = db.IQueryable <OrderEntity>(item => item.OrderDoctorId == model.OrderDoctorId && item.OrderType == orderTimetype && item.OrderDate == model.OrderDateTime).Sum(item => item.OrderId); //坐诊信息 var visit = linq.FirstOrDefault(); if (visit != null) { remainOrderCount = visit.MorningCount - orderedCount; } } break; case OrderTimeTypeEnum.Afternoon: { var orderTimetype = (int)OrderTimeTypeEnum.Afternoon; //查询已预约数量 var orderedCount = db.IQueryable <OrderEntity>(item => item.OrderDoctorId == model.OrderDoctorId && item.OrderType == orderTimetype && item.OrderDate == model.OrderDateTime).Sum(item => item.OrderId); //坐诊信息 var visit = linq.FirstOrDefault(); if (visit != null) { remainOrderCount = visit.AfternoonCount - orderedCount; } } break; case OrderTimeTypeEnum.Night: { var orderTimetype = (int)OrderTimeTypeEnum.Night; //查询已预约数量 var orderedCount = db.IQueryable <OrderEntity>(item => item.OrderDoctorId == model.OrderDoctorId && item.OrderType == orderTimetype && item.OrderDate == model.OrderDateTime).Sum(item => item.OrderId); //坐诊信息 var visit = linq.FirstOrDefault(); if (visit != null) { remainOrderCount = visit.NightCount - orderedCount; } } break; } } else { orderEntity.NumberType = (int)OrderTypeEnum.Segmentation; orderEntity.BeginTime = model.BeginTime; orderEntity.EndTime = model.EndTime; orderEntity.OrderNumber = DateTime.Now.ToString("yyyyMMddHHmmssfff"); switch (model.OrderDateTimeType) { case OrderTimeTypeEnum.Morning: { var orderTimetype = (int)OrderTimeTypeEnum.Morning; //分时段 var segmentationOrder = db.IQueryable <SegmentationOrderEntity>(item => item.DoctorId == model.OrderDoctorId && item.OrderTimeType == orderTimetype).FirstOrDefault(); if (segmentationOrder != null) { //查询已预约数量 var orderedCount = db.IQueryable <OrderEntity>(item => item.OrderDoctorId == model.OrderDoctorId && item.OrderType == orderTimetype && item.OrderDate >= model.BeginTime && item.OrderDate <= model.EndTime).Sum(item => item.OrderId); remainOrderCount = segmentationOrder.OrderCount - orderedCount; } } break; case OrderTimeTypeEnum.Afternoon: { var orderTimetype = (int)OrderTimeTypeEnum.Afternoon; //分时段 var segmentationOrder = db.IQueryable <SegmentationOrderEntity>(item => item.DoctorId == model.OrderDoctorId && item.OrderTimeType == orderTimetype).FirstOrDefault(); if (segmentationOrder != null) { //查询已预约数量 var orderedCount = db.IQueryable <OrderEntity>(item => item.OrderDoctorId == model.OrderDoctorId && item.OrderType == orderTimetype && item.OrderDate >= model.BeginTime && item.OrderDate <= model.EndTime).Sum(item => item.OrderId); remainOrderCount = segmentationOrder.OrderCount - orderedCount; } } break; case OrderTimeTypeEnum.Night: { var orderTimetype = (int)OrderTimeTypeEnum.Afternoon; //分时段 var segmentationOrder = db.IQueryable <SegmentationOrderEntity>(item => item.DoctorId == model.OrderDoctorId && item.OrderTimeType == orderTimetype).FirstOrDefault(); if (segmentationOrder != null) { //查询已预约数量 var orderedCount = db.IQueryable <OrderEntity>(item => item.OrderDoctorId == model.OrderDoctorId && item.OrderType == orderTimetype && item.OrderDate >= model.BeginTime && item.OrderDate <= model.EndTime).Sum(item => item.OrderId); remainOrderCount = segmentationOrder.OrderCount - orderedCount; } } break; } } //如果有剩余,则进行添加 if (remainOrderCount > 0) { //添加预约信息 db.Insert(orderEntity); } addOrderResponse.FullName = model.FullName; addOrderResponse.OrderTime = model.OrderDateTime; addOrderResponse.NumberType = (OrderTypeEnum)orderEntity.NumberType; addOrderResponse.OrderTimeType = (OrderTimeTypeEnum)orderEntity.OrderType; //提交 db.Commit(); } return(addOrderResponse); }
public CategoryService(RepositoryBase <Category> repositoryParameter) { repository = repositoryParameter; }
public CorretorController(RepositoryBase <Corretor> repository) : base(repository) { }
public BlogController(RepositoryBase <Blog> _blogRepo) { blogRepo = _blogRepo; }
public JObject GetListRoles(JObject json, DateTime?StartTime, DateTime?EndTime) { using (var db = new RepositoryBase(DBFactory.oas)) { #region Old //json = json ?? new JObject(); //Pagination page = json["Pagination"] == null ? Pagination.GetDefaultPagination("KeyId") : JsonConvert.DeserializeObject<Pagination>(json["Pagination"].ToString()); //Expression<Func<Admin_Sys_Roles, bool>> expression = PredicateExtensions.True<Admin_Sys_Roles>(); //PaginationResult<List<Admin_Sys_Roles>> ResultPage = new PaginationResult<List<Admin_Sys_Roles>>(); //var userList = db.FindList(page ?? Pagination.GetDefaultPagination("KeyId"), out page, expression); //JObject result = new JObject(); //if (!string.IsNullOrEmpty(json["Param"]["Type"].ToString())) //{ // userList = userList.FindAll(a => a.RoleName.Contains(json["Param"]["Type"].ToString())); //} //ResultPage.datas = userList.ToList(); ////权限分配菜单 //var list = db.IQueryable<Admin_Sys_Navigations>(a => (bool)a.IsVisible).ToList(); //var menuList = new List<NavigationModel>(); //foreach (var item in list.Where(it => it.ParentID == 0)) //{ // var menuModel = new NavigationModel(); // menuModel.KeyId = item.KeyId; // menuModel.NavTitle = item.NavTitle; // menuModel.Linkurl = item.Linkurl; // menuModel.Sortnum = (int)item.Sortnum; // menuModel.ParentID = (int)item.ParentID; // menuModel.ChildNodes = // list.Where(c => c.ParentID == item.KeyId) // .Select( // c => // new ChilNavdNodes // { // KeyId = c.KeyId, // NavTitle = c.NavTitle, // Linkurl = c.Linkurl, // Sortnum = (int)c.Sortnum, // ParentID = (int)c.ParentID // }) // .OrderBy(c => c.Sortnum).ToList(); // menuList.Add(menuModel); //} //menuList = menuList.OrderBy(c => c.Sortnum).ToList(); //if (page != null) //{ // ResultPage.pagination = page; //} //if (ResultPage.datas.Count > 0) //{ // result.Add(ResultInfo.Result, JProperty.FromObject(true)); // result.Add(ResultInfo.Content, JProperty.FromObject(ResultPage)); // result.Add("RolesMenu", JProperty.FromObject(menuList)); //} //else //{ // result.Add(ResultInfo.Result, JProperty.FromObject(false)); // result.Add(ResultInfo.Content, JProperty.FromObject("无数据")); //} #endregion #region json = json ?? new JObject(); Pagination page = json["Pagination"] == null?Pagination.GetDefaultPagination("Role_id") : JsonConvert.DeserializeObject <Pagination>(json["Pagination"].ToString()); Expression <Func <T_Pub_Role, bool> > expression = PredicateExtensions.True <T_Pub_Role>(); PaginationResult <List <T_Pub_Role> > ResultPage = new PaginationResult <List <T_Pub_Role> >(); var userList = db.FindList(page ?? Pagination.GetDefaultPagination("Role_id"), out page, expression); JObject result = new JObject(); if (!string.IsNullOrEmpty(json["Param"]["Type"].ToString())) { userList = userList.FindAll(a => a.Role_Name.Contains(json["Param"]["Type"].ToString())); } ResultPage.datas = userList.ToList(); if (page != null) { ResultPage.pagination = page; } if (ResultPage.datas.Count > 0) { result.Add(ResultInfo.Result, JProperty.FromObject(true)); result.Add(ResultInfo.Content, JProperty.FromObject(ResultPage)); //result.Add("RolesMenu", JProperty.FromObject(menuList)); } else { result.Add(ResultInfo.Result, JProperty.FromObject(false)); result.Add(ResultInfo.Content, JProperty.FromObject("无数据")); } #endregion return(result); } }
public ConnectTypeController() { Repository = new RepositoryBase(); }
public void SubmitForm(ProfileDeducInsSubMitContracts entity, string keyValue, string DeducIns_Id) { using (var db = new RepositoryBase().BeginTrans()) { //获取评分标准。 var scNormEntity = LinqSQLExtensions.IQueryable <ProfileScireCriteria_NormEntity>().Where(d => d.SNormId == entity.NormId).FirstOrDefault(); var scClassifyEntity = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_ClassifyEntity>().Where(d => d.SClassifyId == scNormEntity.SClassifyId).FirstOrDefault(); var scTypeEntit = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_TypeEntity>().Where(d => d.STypeId == scClassifyEntity.STypeId).FirstOrDefault(); var scEntryEntity = LinqSQLExtensions.IQueryable <ProfileScoreCriteria_EntryEntity>().Where(d => d.SEntryId == scTypeEntit.SEntryId).FirstOrDefault(); //判断当前当中是存在数据,如果存在则是修改 //两条具体使用哪一个? var deducInsQuery = db.IQueryable <ProfileDeducInsEntity>().Where(d => d.DeducIns_Id == DeducIns_Id); if (!string.IsNullOrEmpty(DeducIns_Id)) { var deducInsEntiy = deducInsQuery.FirstOrDefault(); deducInsEntiy.TaskEntry_Id = entity.TaskEntryId; deducInsEntiy.SCNorm_Id = entity.NormId; deducInsEntiy.SCNormProjectName = scNormEntity.SNormProjectName; deducInsEntiy.SCNormStandardName = scNormEntity.SNormStandardName; deducInsEntiy.SCClassifyName = scClassifyEntity.SClassifyName; deducInsEntiy.SCTypeName = scTypeEntit.Name; deducInsEntiy.SCEntryName = scEntryEntity.Name; deducInsEntiy.DeductionScore = entity.DeductionScore; deducInsEntiy.DeductionSeveral = entity.DeductionSeveral; deducInsEntiy.DeductionDescribe = entity.DeductionDescribe; deducInsEntiy.LastModifyTime = DateTime.Now; deducInsEntiy.LastModifyUserId = OperatorProvider.Provider.GetCurrent().UserId; deducInsEntiy.LastModifyUserName = OperatorProvider.Provider.GetCurrent().UserName; db.Update <ProfileDeducInsEntity>(deducInsEntiy); } else { ProfileDeducInsEntity deducInsEntity = new ProfileDeducInsEntity() { DeducIns_Id = keyValue, TaskEntry_Id = entity.TaskEntryId, SCNorm_Id = entity.NormId, SCNormProjectName = scNormEntity.SNormProjectName, SCNormStandardName = scNormEntity.SNormStandardName, SCClassifyName = scClassifyEntity.SClassifyName, SCTypeName = scTypeEntit.Name, SCEntryName = scEntryEntity.Name, DeductionScore = entity.DeductionScore, DeductionSeveral = entity.DeductionSeveral, DeductionDescribe = entity.DeductionDescribe, CreateTime = DateTime.Now, CreatorUserId = OperatorProvider.Provider.GetCurrent().UserId, CreatorUserName = OperatorProvider.Provider.GetCurrent().UserName }; db.Insert <ProfileDeducInsEntity>(deducInsEntity); } db.Commit(); } }
public UsersContent() { _usersRepository = new RepositoryBase <User>(); _subdivisionsRepository = new RepositoryBase <Subdivision>(); }
public TopicGraphNavigator(RepositoryBase<Topic> topicRepository) { this.topicsRepository = topicRepository; }
public ChatHub() { DataChatBox data = new DataChatBox(); UnitOfWork _Unit = new UnitOfWork(data); _ChatClient = new RepositoryBase <chatclient>(_Unit); _Chatagent = new RepositoryBase <chatagent2>(_Unit); _ChatVisitor = new RepositoryBase <Visitor>(_Unit); _LineChat = new RepositoryBase <ChatLine>(_Unit); }
public PostsController(RepositoryBase <Post> repo, RepositoryBase <Comment> commentRepo) { this.repo = repo; this.commentRepo = commentRepo; }
private void Window_Loaded(object sender, RoutedEventArgs e) { var rep = new RepositoryBase<Medico>(); ShareList = new ObservableCollection<MedicoGrid>(); rep.Listar().Select(x => new MedicoGrid() { Nome = x.Nome, CRM = x.CRM }).ToList().ForEach(x=> ShareList.Add(x)); DataContext= ShareList; }
public IRepositoryBase <TModel> RepositoryFor <TModel>() where TModel : ModelBase, new() { IRepositoryBase <TModel> result = new RepositoryBase <LmPlatformModelsContext, TModel>(_dataContext); return(result); }
private void ResetRepositories() { repBeobachtungen = null; repFächer = null; repKlassen = null; repSchueler = null; repSchuljahre = null; repSettings = null; }
public ControllerBase(DataContext context) { this._context = context; repository = new RepositoryBase <T>(_context); }
public RoleService(RepositoryBase <Role> repositoryParameter) { repository = repositoryParameter; }
public ActionResult ReLaunchBranchAssessment(string assessment_id, string file_name) { AssessmentEntity assessmentEntity = assessmentApp.GetForm(assessment_id); if (assessmentEntity == null) { return(Error("系统未知错误。")); } //if (assessmentEntity.assessment_statue != 1) return Error("只有处于待归档的考核才能重新发起。"); List <AssessmentDetailEntity> assessmentDetailList = assessmentDetailApp.GetListByAssessmentId(assessment_id); if (assessmentDetailList == null || assessmentDetailList.Count <= 0) { return(Error("系统未知错误。")); } List <SelfTaskDetailEntity> selfTaskDetailList = selfTaskDetailApp.GetListByAttach(assessment_id); if (selfTaskDetailList == null || selfTaskDetailList.Count <= 0) { return(Error("系统未知错误。")); } List <AssessmentResultCountEntity> assessmentResultCountList = assessmentResultCountApp.GetByAssessmentId(assessment_id); if (assessmentResultCountList == null || assessmentResultCountList.Count <= 0) { return(Error("系统未知错误。")); } using (var db = new RepositoryBase().BeginTrans()) { //将本次考核状态设置为初始状态 0 assessmentEntity.assessment_statue = 0; assessmentEntity.last_modify_time = DateTime.Now; db.Update <AssessmentEntity>(assessmentEntity); //更新考核发起详细表 assessmentDetailList.ForEach((t) => { t.finished = 0; t.last_modify_time = DateTime.Now; db.Update <AssessmentDetailEntity>(t); }); //1.更新所有任务表状态为未激活 selfTaskDetailList.ForEach((t) => { t.task_statue = 0; t.last_modify_time = DateTime.Now; db.Update <SelfTaskDetailEntity>(t); }); //2.更新check_order为1的任务状态为已激活 selfTaskDetailList.ForEach((t) => { List <AssessmentDetailEntity> list = assessmentDetailApp.GetFirstCheckerList(assessment_id); list.ForEach((tt) => { if (t.person == tt.checker) { t.task_statue = 1; } }); }); //删除上次考核成绩 assessmentResultCountList.ForEach((t) => { db.Delete <AssessmentResultCountEntity>(t); }); //导入考核数据 BranchAssessmentImportApp branchAssessmentImportApp = new BranchAssessmentImportApp(db); var data = branchAssessmentImportApp.Scan(file_name, new string[] { assessment_id }); if (data.Count > 0) { return(Error("导入数据存在未处理的错误!")); } else { branchAssessmentImportApp.Import(file_name, assessment_id); } db.Commit(); } return(Success("操作成功。", null)); }
public ActionResult Register(RegisterViewModel model) { if (ModelState.IsValid) { try { var repository = new RepositoryBase<LmPlatformModelsContext, AccessCode>(new LmPlatformModelsContext()); var code = repository.GetAll().OrderBy(e => e.Id).ToList().LastOrDefault(); if (code.Number.ToLower() != model.Code.ToLower()) { throw new Exception("Неверный код доступа"); } model.RegistrationUser(new[] { "student" }); return RedirectToAction("Index", "Home"); } catch (MembershipCreateUserException e) { ModelState.AddModelError(string.Empty, ErrorCodeToString(e.StatusCode)); } catch (Exception e) { ModelState.AddModelError(string.Empty, e.Message); } } return View(model); }
public RolesServices(RepositoryBase <Roles, int> rolesData) { RolesData = rolesData; }