public ActionResult DeleteConfirmed(int id) { CodeTooling codeTooling = db.CodeToolings.Find(id); db.CodeToolings.Remove(codeTooling); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,TypeTooling,DescTooling,BegDate,EndDate")] CodeTooling codeTooling) { if (ModelState.IsValid) { db.Entry(codeTooling).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(codeTooling)); }
public ActionResult Create([Bind(Include = "Id,TypeTooling,DescTooling,BegDate,EndDate")] CodeTooling codeTooling) { if (ModelState.IsValid) { db.CodeToolings.Add(codeTooling); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(codeTooling)); }
// GET: Directories/CodeToolings/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CodeTooling codeTooling = db.CodeToolings.Find(id); if (codeTooling == null) { return(HttpNotFound()); } return(View(codeTooling)); }
protected override void Seed(CcRepContext context) { IList <Section> defaultSections = new List <Section>() { new Section() { _Section = "1.1" }, new Section() { _Section = "1.2" }, new Section() { _Section = "2.1" }, new Section() { _Section = "2.2" } }; context.Sections.AddRange(defaultSections); SetPathToCsvFiles(); CcRepCsvParser csvParser = new CcRepCsvParser(path_to_csv); // Asp roles var defaultAspRoles = csvParser.CsvParserStart <CcRepRole>(new CsvCcRepRoleMapping(), "dic_asp_roles.csv"); ((DbSet <CcRepRole>)context.Roles).AddRange(defaultAspRoles); // AcctReport (ok) and ClientType (ok) var defaultAcctReports = csvParser.CsvParserStart <AcctReport>(new CsvAcctReportMapping(), "dic_acc_report.csv"); var tempClientTypes = csvParser.CsvParserStart <ClientType>(new CsvClientTypeAcctReportMapping(), "dic_acc_report.csv"); var defaultClientTypes = csvParser.CsvParserStart <ClientType>(new CsvClientTypeMapping(), "dic_client_types.csv"); { // Fill the table DIC_ACCT_REPORT_TO_CLIENT_TYPE for (int i = 0; i < tempClientTypes.Count; i++) { if (tempClientTypes[i] == null || defaultAcctReports[i] == null || String.IsNullOrEmpty(tempClientTypes[i].NameShort)) { continue; } foreach (ClientType ct in defaultClientTypes) { if (ct == null) { continue; } if (tempClientTypes[i].NameShort.Equals(ct.NameShort)) { defaultAcctReports[i].ClientTypes.Add(ct); break; } } } } context.ClientTypes.AddRange(defaultClientTypes); context.AcctReports.AddRange(defaultAcctReports); // context.ClientTypes.AddOrUpdate<ClientType>(defaultClientTypes.ToArray<ClientType>()); // context.AcctReports.AddOrUpdate<AcctReport>(defaultAcctReports.ToArray<AcctReport>()); // AddValue10 (ok) var defaultAddValue10 = csvParser.CsvParserStart <AddValue10>(new CsvAddValue10Mapping(), "dic_add_value_10.csv"); context.AddValues10.AddRange(defaultAddValue10); // context.AddValues10.AddOrUpdate<AddValue10>(defaultAddValue10.ToArray<AddValue10>()); // DirectionPay (ok) var defaultDirectionCodes = csvParser.CsvParserStart <DirectionPay>(new CsvDirectionPayMapping(), "dic_direction_pay.csv"); // SettingCodeVO and CodeTooling and SettingCodeVOSection IList <SettingCodeVOSection> sections = new List <SettingCodeVOSection>(); var defaultSettingCodeVOs = csvParser.CsvParserStart <SettingCodeVO>(new CsvSettingCodeVOsMapping(), "dic_setting_code_vo.csv"); foreach (SettingCodeVO scv in defaultSettingCodeVOs) { if (String.IsNullOrEmpty(scv.OperationCodeRef)) { scv.OperationCodeRef = null; } else { DirectionPay dp = Array.Find <DirectionPay>(defaultDirectionCodes.ToArray <DirectionPay>(), x => x.Direction_Pay == scv.OperationCodeRef); scv.OperationCodeRef = null; if (dp != null) { scv.OperationCode = dp; } } if (scv.SectionRef.HasValue) { SettingCodeVOSection section = Array.Find <SettingCodeVOSection>(sections.ToArray <SettingCodeVOSection>(), x => x.SectionNo == scv.SectionRef.Value); if (section == null) { section = new SettingCodeVOSection() { SectionNo = scv.SectionRef.Value, Desc = "" }; sections.Add(section); } section.Desc = "Без описания"; scv.Section = section; } } var tempCodeTooling = csvParser.CsvParserStart <CodeTooling>(new CsvCodeToolingSettingCodeVOsMapping(), "dic_setting_code_vo.csv"); var defaultCodeToolings = csvParser.CsvParserStart <CodeTooling>(new CsvCodeToolingMapping(), "dic_code_tooling.csv"); { // Fill the table DIC_SETTING_CODE_VO_TO_CODE_TOOLINGS for (int i = 0; i < tempCodeTooling.Count; i++) { CodeTooling temp_ct = tempCodeTooling[i]; if (temp_ct == null || String.IsNullOrEmpty(temp_ct.TypeTooling)) { continue; } foreach (CodeTooling ct in defaultCodeToolings) { if (ct == null) { continue; } if (temp_ct.TypeTooling.Equals(ct.TypeTooling)) { if (defaultSettingCodeVOs[i] == null) { break; } defaultSettingCodeVOs[i].CodeToolings.Add(ct); break; } } } } context.CodeToolings.AddRange(defaultCodeToolings); context.SettingCodeVOs.AddRange(defaultSettingCodeVOs); // context.CodeToolings.AddOrUpdate<CodeTooling>(defaultCodeToolings.ToArray<CodeTooling>()); // context.SettingCodeVOs.AddOrUpdate<SettingCodeVO>(defaultSettingCodeVOs.ToArray<SettingCodeVO>()); context.DirectionPays.AddRange(defaultDirectionCodes); // context.DirectionPays.AddOrUpdate<DirectionPay>(defaultDirectionCodes.ToArray<DirectionPay>()); // CodeVORep (ok) var defaultCodeVOReps = csvParser.CsvParserStart <CodeVORep>(new CsvCodeVORepMapping(), "dic_code_vo_rep.csv"); context.CodeVOReps.AddRange(defaultCodeVOReps); // context.CodeVOReps.AddOrUpdate<CodeVORep>(defaultCodeVOReps.ToArray<CodeVORep>()); // Filial (ok) var defaultFilials = csvParser.CsvParserStart <Filial>(new CsvFilialMapping(), "dic_filial.csv"); context.Filials.AddRange(defaultFilials); // context.Filials.AddOrUpdate<Filial>(defaultFilials.ToArray<Filial>()); // IssuerCode (ok) var defaultIssuerCodes = csvParser.CsvParserStart <IssuerCode>(new CsvIssuerCodeMapping(), "dic_issuer_code.csv"); context.IssuerCodes.AddRange(defaultIssuerCodes); // context.IssuerCodes.AddOrUpdate<IssuerCode>(defaultIssuerCodes.ToArray<IssuerCode>()); // KeywordsException (ok) var defaultKeywordsExceptions = csvParser.CsvParserStart <KeywordsException>(new CsvKeywordsExceptionMapping(), "dic_keywords_exception.csv"); context.KeywordsExceptions.AddRange(defaultKeywordsExceptions); // context.KeywordsExceptions.AddOrUpdate<KeywordsException>(defaultKeywordsExceptions.ToArray<KeywordsException>()); // KindContract (ok) var defaultKindContracts = csvParser.CsvParserStart <KindContract>(new CsvKindContractMapping(), "dic_kind_contract.csv"); context.KindContracts.AddRange(defaultKindContracts); // context.KindContracts.AddOrUpdate<KindContract>(defaultKindContracts.ToArray<KindContract>()); // KindNeRez (ok) var defaultKindNerezs = csvParser.CsvParserStart <KindNeRez>(new CsvKindNerezMapping(), "dic_kind_nerez.csv"); context.KindNerezs.AddRange(defaultKindNerezs); // context.KindNerezs.AddOrUpdate<KindNeRez>(defaultKindNerezs.ToArray<KindNeRez>()); // KindRez (ok) var defaultKindRezs = csvParser.CsvParserStart <KindRez>(new CsvKindRezMapping(), "dic_kind_rez.csv"); context.KindRezs.AddRange(defaultKindRezs); // context.KindRezs.AddOrUpdate<KindRez>(defaultKindRezs.ToArray<KindRez>()); // OperKind (ok) var defaultOperKinds = csvParser.CsvParserStart <OperKind>(new CsvOperKindMapping(), "dic_oper_kind.csv"); context.OperKinds.AddRange(defaultOperKinds); // context.OperKinds.AddOrUpdate<OperKind>(defaultOperKinds.ToArray<OperKind>()); // OperType (ok) var defaultOperTypes = csvParser.CsvParserStart <OperType>(new CsvOperTypeMapping(), "dic_oper_type.csv"); context.OperTypes.AddRange(defaultOperTypes); // context.OperTypes.AddOrUpdate<OperType>(defaultOperTypes.ToArray<OperType>()); // PDType (ok) var defaultPDTypes = csvParser.CsvParserStart <PDType>(new CsvPDTypeMapping(), "dic_pd_type.csv"); context.PDTypes.AddRange(defaultPDTypes); // context.PDTypes.AddOrUpdate<PDType>(defaultPDTypes.ToArray<PDType>()); // StatusOper var defaultStatusOpers = csvParser.CsvParserStart <StatusOper>(new CsvStatusOperMapping(), "dic_status_oper.csv"); foreach (StatusOper so in defaultStatusOpers) { if (String.IsNullOrEmpty(so.SUPDOC_FL)) { so.SUPDOC_FL = null; } } context.StatusOpers.AddRange(defaultStatusOpers); // context.StatusOpers.AddOrUpdate<StatusOper>(defaultStatusOpers.ToArray<StatusOper>()); // TypeClient and StatusRez var defaultStatusRezs = csvParser.CsvParserStart <StatusRez>(new CsvStatusRezMapping(), "dic_status_rez.csv"); var tempTypeClients = csvParser.CsvParserStart <TypeClient>(new CsvTypeClientStatusRezMapping(), "dic_type_client_status_rez.csv"); var defaultTypeClients = csvParser.CsvParserStart <TypeClient>(new CsvTypeClientMapping(), "dic_type_client.csv"); { // Fill the table TypeClientStatusRezs foreach (TypeClient temp_tc in tempTypeClients) { foreach (StatusRez cr in defaultStatusRezs) { if (temp_tc.Description.Equals(cr.Status)) { foreach (TypeClient tc in defaultTypeClients) { if (tc.Type_Client.Equals(temp_tc.Type_Client)) { tc.StatusRezs.Add(cr); break; } } break; } } } } context.StatusRezs.AddRange(defaultStatusRezs); context.TypeClients.AddRange(defaultTypeClients); // context.StatusRezs.AddOrUpdate<StatusRez>(defaultStatusRezs.ToArray<StatusRez>()); //context.TypeClients.AddOrUpdate<TypeClient>(defaultTypeClients.ToArray<TypeClient>()); // TypeContract var defaultTypeContracts = csvParser.CsvParserStart <TypeContract>(new CsvTypeContractMapping(), "dic_type_contract.csv"); context.TypeContracts.AddRange(defaultTypeContracts); // context.TypeContracts.AddOrUpdate<TypeContract>(defaultTypeContracts.ToArray<TypeContract>()); base.Seed(context); // LoadArchiveFromExcel(context); }
// GET: Directories/CodeToolings/Create public ActionResult Create() { var model = new CodeTooling(); return(View(model)); }