public override Tuple <CallContext, string> UserControlSave() { this.currentEntity = this.ownerPage.CostCalculationRef.GetOfferByID(this.CurrentEntityMasterID); if (this.currentEntity == null) { string falseResult = string.Format(BaseHelper.GetCaptionString("Entity_is_not_update_in_tab"), BaseHelper.GetCaptionString("UserMain_Data")); this.ownerPage.CallContext.ResultCode = ETEMEnums.ResultEnum.Error; this.ownerPage.CallContext.Message = falseResult; return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("BilletScrapData_Data"))); } this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser; this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.OfferSave(this.currentEntity, this.ownerPage.CallContext); this.lbResultContext.Text = this.ownerPage.CallContext.Message; if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID; } CheckIfResultIsSuccess(); return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("OfferMain_Data"))); }
public ActionResult UserList() { ViewBag.RoleList = BaseHelper.GetRoleList(string.Empty); ViewBag.DepartList = BaseHelper.GetDepartList(string.Empty); return(View()); }
public override Tuple <CallContext, string> UserControlSave() { OfferProducitivity offerProducitivity = this.ownerPage.CostCalculationRef.GetOfferProducitivityByOfferID(this.CurrentEntityMasterID); this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser; if (offerProducitivity != null) { KeyValue kvSelectPress, kvPackaging; kvSelectPress = this.ownerPage.GetKeyValueByID(offerProducitivity.idPress); kvPackaging = this.ownerPage.GetKeyValueByIntCode("CostCenter", "Packaging"); offerProducitivity.PressProducitivity_KG_MH = BaseHelper.ConvertToDecimalOrZero(this.tbxPressProducitivity_KG_MH.Text); if (offerProducitivity.PressProducitivity_KG_MH > BaseHelper.ConvertToDecimalOrZero(kvSelectPress.DefaultValue3)) { offerProducitivity.PressProducitivity_KG_MH = BaseHelper.ConvertToDecimalOrZero(kvSelectPress.DefaultValue3); this.tbxPressProducitivity_KG_MH.Text = offerProducitivity.PressProducitivity_KG_MH.ToStringNotFormatted(); } offerProducitivity.PressProducitivity_TON_MH = offerProducitivity.PressProducitivity_TON_MH_Computable; offerProducitivity.COMetalProducitivity_KG_MH = offerProducitivity.PressProducitivity_KG_MH; //Productivity for QC and COMETAL is equal to productivity for press offerProducitivity.COMetalProducitivity_TON_MH = offerProducitivity.COMetalProducitivity_TON_MH_Computable; offerProducitivity.QCProducitivity_KG_MH = offerProducitivity.PressProducitivity_KG_MH; //Productivity for QC and COMETAL is equal to productivity for press offerProducitivity.QCProducitivity_TON_MH = offerProducitivity.QCProducitivity_TON_MH_Computable; offerProducitivity.PackagingProducitivity_KG_MH = BaseHelper.ConvertToDecimalOrZero(this.tbxPackagingProducitivity_KG_MH.Text); if (offerProducitivity.PackagingProducitivity_KG_MH > BaseHelper.ConvertToDecimalOrZero(kvPackaging.DefaultValue3)) { offerProducitivity.PackagingProducitivity_KG_MH = BaseHelper.ConvertToDecimalOrZero(kvPackaging.DefaultValue3); this.tbxPackagingProducitivity_KG_MH.Text = offerProducitivity.PackagingProducitivity_KG_MH.ToStringNotFormatted();; } offerProducitivity.PackagingProducitivity_TON_MH = offerProducitivity.PackagingProducitivity_TON_MH_Computable; this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.OfferProducitivitySave(offerProducitivity, this.ownerPage.CallContext); } this.lbResultContext.Text = this.ownerPage.CallContext.Message; if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.hdnRowMasterKey.Value = this.ownerPage.CallContext.EntityID; } CheckIfResultIsSuccess(); return(new Tuple <CallContext, string>(this.ownerPage.CallContext, BaseHelper.GetCaptionString("OfferMain_Data"))); }
protected void chbxCheckOrUncheckAll_OnCheckedChanged(object sender, EventArgs e) { CheckBox chbx = sender as CheckBox; BaseHelper.SelectOrDeselectAllEnabledGridCheckBox(this.gvSAPDataExpenses, chbx.Checked, "chbxCheckForDeletion"); }
public ActionResult Busqueda() {//Consultar videos de la BD ViewData["video"] = BaseHelper.ejecutarConsulta( "select * from video Where titulo Like '%@titulo%' ", CommandType.Text); return(View()); }
protected void btnSave_Click(object sender, EventArgs e) { if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.DieFormulaSave, false)) { return; } if (ddlNumberCavities.SelectedValue == Constants.INVALID_ID_STRING) { AddErrorMessage(this.lbResultContext, BaseHelper.GetCaptionString("Please_add_NumberCavities")); return; } if (ddlProfileCategory.SelectedValue == Constants.INVALID_ID_STRING) { AddErrorMessage(this.lbResultContext, BaseHelper.GetCaptionString("Please_add_ProfileCategory")); return; } if (ddlProfileType.SelectedValue == Constants.INVALID_ID_STRING) { AddErrorMessage(this.lbResultContext, BaseHelper.GetCaptionString("Please_add_ProfileType")); return; } this.CurrentEntityMasterID = this.hdnRowMasterKey.Value; DieFormula dieFormula = new DieFormula(); //редакция if (this.CurrentEntityMasterID != Constants.INVALID_ID_STRING && !string.IsNullOrEmpty(this.CurrentEntityMasterID)) { dieFormula = this.ownerPage.CostCalculationRef.GetDieFormulaById(this.CurrentEntityMasterID); dieFormula.idModifyUser = Convert.ToInt32(this.ownerPage.UserProps.IdUser); dieFormula.dModify = DateTime.Now; } //нов документ else { dieFormula.idCreateUser = Convert.ToInt32(this.ownerPage.UserProps.IdUser); dieFormula.dCreate = DateTime.Now; } dieFormula.idNumberOfCavities = this.ddlNumberCavities.SelectedValueINT; dieFormula.idProfileType = this.ddlProfileType.SelectedValueINT; dieFormula.idProfileCategory = this.ddlProfileCategory.SelectedValueINT; dieFormula.DieFormulaText = this.tbxDieFormulaText.Text; this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.DieFormulaSave(dieFormula, this.ownerPage.CallContext); if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success) { this.CurrentEntityMasterID = dieFormula.EntityID.ToString(); UserControlLoad(); RefreshParent(); EvaluateExpressionHelper eval = new EvaluateExpressionHelper(); Dictionary <string, string> vals = new Dictionary <string, string>(); vals.Add("A", "100"); vals.Add("B", "100"); vals.Add("C", "100"); vals.Add("D", "100"); vals.Add("s", "4"); vals.Add("Ø", "4"); try { eval.EvalExpression(this.tbxDieFormulaText.Text, vals).ToString(); } catch (Exception ex) { this.ownerPage.ShowMSG(ex.Message.Replace("'", "\"")); } } CheckIfResultIsSuccess(this.lbResultContext); lbResultContext.Text = this.ownerPage.CallContext.Message; }
public ResponseMessageResult Putfa_business_basic(fa_business_basic fa_business_basic) { JwtModel jwtmodel = JwtHelper.getToken(HttpContext.Current.Request.Headers.GetValues("Authorization").First().ToString()); if (jwtmodel.isadmin) { var info = db.fa_business_basic.Find(fa_business_basic.id); if (!string.IsNullOrEmpty(fa_business_basic.password)) { info.password = BaseHelper.Md5Hash(fa_business_basic.password); } info.isaudit = fa_business_basic.isaudit; info.merchantid = fa_business_basic.merchantid; info.merchantName = fa_business_basic.merchantName; info.shortName = fa_business_basic.shortName; info.handleType = fa_business_basic.handleType; info.city = fa_business_basic.city; info.merchantAddress = fa_business_basic.merchantAddress; info.servicePhone = fa_business_basic.servicePhone; info.orgCode = fa_business_basic.orgCode; info.merchantType = fa_business_basic.merchantType; info.category = fa_business_basic.category; info.corpmanName = fa_business_basic.corpmanName; info.corpmanId = fa_business_basic.corpmanId; info.corpmanPhone = fa_business_basic.corpmanPhone; info.corpmanMobile = fa_business_basic.corpmanMobile; info.corpmanEmail = fa_business_basic.corpmanEmail; info.bankCode = fa_business_basic.bankCode; info.bankName = fa_business_basic.bankName; info.bankaccountNo = fa_business_basic.bankaccountNo; info.bankaccountName = fa_business_basic.bankaccountName; info.autoCus = fa_business_basic.autoCus; info.remark = fa_business_basic.remark; info.licenseNo = fa_business_basic.licenseNo; info.taxRegisterNo = fa_business_basic.taxRegisterNo; info.agencyId = fa_business_basic.agencyId; info.appId = fa_business_basic.appId; info.appSecret = fa_business_basic.appSecret; info.status = fa_business_basic.status; info.addrType = fa_business_basic.addrType; info.contactType = fa_business_basic.contactType; info.mcc = fa_business_basic.mcc; info.licenseType = fa_business_basic.licenseType; info.contactMan = fa_business_basic.contactMan; info.telNo = fa_business_basic.telNo; info.mobilePhone = fa_business_basic.mobilePhone; info.email = fa_business_basic.email; info.licenseBeginDate = fa_business_basic.licenseBeginDate; info.licenseEndDate = fa_business_basic.licenseEndDate; info.licenseRange = fa_business_basic.licenseRange; info.updatetime = DateTime.Now; info.updateuser = jwtmodel.username; try { model.message = "修改成功"; model.status_code = 200; db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { model.message = ex.Message; model.status_code = 401; } } else { model.message = "用户权限不足"; model.status_code = 401; } return(new ResponseMessageResult(Request.CreateResponse((HttpStatusCode)model.status_code, model))); }
public CallContext ImportSAPDataExpensesAndQuantities(string fileFullName, int idEntity, CallContext resultContext) { try { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; FileInfo excelFile = new FileInfo(fileFullName); using (ExcelPackage package = new ExcelPackage(excelFile)) { int currRow = 1; int currCol = 0; bool res; decimal resultParseDecimal; int resultParseInt; ExcelWorksheet workSheetExpenses = package.Workbook.Worksheets[1]; ExcelWorksheet workSheetQuantity = package.Workbook.Worksheets[2]; if (workSheetExpenses == null && workSheetQuantity == null) { resultContext.Message = "Error! No Excel work sheet `Expenses` and `Quantity`!"; return(resultContext); } else if (workSheetExpenses == null) { resultContext.Message = "Error! No Excel work sheet `Expenses`!"; return(resultContext); } else if (workSheetQuantity == null) { resultContext.Message = "Error! No Excel work sheet `Quantity`!"; return(resultContext); } SAPData _SAPData = this.GetEntityById(idEntity); if (_SAPData == null) { resultContext.Message = "Entity `SAPData` not found by ID (`" + idEntity + "`)!"; return(resultContext); } List <string> listKeyTypeIntCodes = new List <string>() { ETEMEnums.KeyTypeEnum.CostCenter.ToString(), ETEMEnums.KeyTypeEnum.ExpensesType.ToString(), ETEMEnums.KeyTypeEnum.QuantityType.ToString() }; List <KeyValueDataView> listKeyValuesToSAPDataExpensesAndQuantity = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueCostCenter = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueExpensesType = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueQuantityType = new List <KeyValueDataView>(); listKeyValuesToSAPDataExpensesAndQuantity = (from kv in this.dbContext.KeyValues join kt in this.dbContext.KeyTypes on kv.idKeyType equals kt.idKeyType where listKeyTypeIntCodes.Contains(kt.KeyTypeIntCode) select new KeyValueDataView { idKeyValue = kv.idKeyValue, Name = kv.Name, NameEN = kv.NameEN, DefaultValue1 = kv.DefaultValue1, KeyValueIntCode = kv.KeyValueIntCode, KeyTypeIntCode = kt.KeyTypeIntCode } ).ToList <KeyValueDataView>(); listKeyValueCostCenter = listKeyValuesToSAPDataExpensesAndQuantity.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.CostCenter.ToString()).ToList(); listKeyValueExpensesType = listKeyValuesToSAPDataExpensesAndQuantity.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.ExpensesType.ToString()).ToList(); listKeyValueQuantityType = listKeyValuesToSAPDataExpensesAndQuantity.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.QuantityType.ToString()).ToList(); List <SAPDataExpense> listSAPDataExpenseOld = new List <SAPDataExpense>(); List <SAPDataQuantity> listSAPDataQuantityOld = new List <SAPDataQuantity>(); List <SAPDataExpense> listSAPDataExpenseNew = new List <SAPDataExpense>(); List <SAPDataQuantity> listSAPDataQuantityNew = new List <SAPDataQuantity>(); listSAPDataExpenseOld = (from sde in this.dbContext.SAPDataExpenses where sde.idSAPData == _SAPData.idSAPData select sde).ToList <SAPDataExpense>(); listSAPDataQuantityOld = (from sdq in this.dbContext.SAPDataQuantities where sdq.idSAPData == _SAPData.idSAPData select sdq).ToList <SAPDataQuantity>(); Dictionary <string, string> dictErrorsExpenses = new Dictionary <string, string>(); Dictionary <string, string> dictErrorsQuantities = new Dictionary <string, string>(); SAPDataExpense newSAPDataExpense = new SAPDataExpense(); SAPDataQuantity newSAPDataQuantity = new SAPDataQuantity(); bool hasNotErrorInRow = true; string rangeValueStr = string.Empty; ExcelRange range; for (int i = 4; i < listKeyValueCostCenter.Count + 4; i++) { for (int j = 2; j < listKeyValueExpensesType.Count + 2; j++) { hasNotErrorInRow = true; currRow = 1; range = workSheetExpenses.Cells[currRow, i]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); var kvCostCenter = listKeyValueCostCenter.Where(w => w.Name.Trim().ToUpper() == rangeValueStr.Trim().ToUpper()).FirstOrDefault(); newSAPDataExpense = new SAPDataExpense(); newSAPDataExpense.idSAPData = idEntity; if (kvCostCenter != null) { newSAPDataExpense.idCostCenter = kvCostCenter.idKeyValue; } else { hasNotErrorInRow = false; if (dictErrorsExpenses.ContainsKey("CostCenterExpenses")) { dictErrorsExpenses["CostCenterExpenses"] += "," + i; } else { dictErrorsExpenses.Add("CostCenterExpenses", i.ToString()); } } currCol = 2; range = workSheetExpenses.Cells[j, currCol]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); var kvExpensesType = listKeyValueExpensesType.Where(w => w.KeyValueIntCode.Trim().ToUpper() == rangeValueStr.Trim().ToUpper()).FirstOrDefault(); if (kvExpensesType != null) { newSAPDataExpense.idExpensesType = kvExpensesType.idKeyValue; } else { hasNotErrorInRow = false; if (dictErrorsExpenses.ContainsKey("ExpensesType")) { dictErrorsExpenses["ExpensesType"] += "," + j; } else { dictErrorsExpenses.Add("ExpensesType", j.ToString()); } } range = workSheetExpenses.Cells[j, i]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); res = Decimal.TryParse(rangeValueStr, NumberStyles.Any, BaseHelper.GetNumberFormatInfo("", ".", 4), out resultParseDecimal); if (res) { newSAPDataExpense.ValueData = resultParseDecimal; } else { newSAPDataExpense.ValueData = decimal.Zero; } var checkSAPDataExpenses = listSAPDataExpenseOld.Where(w => w.idCostCenter == newSAPDataExpense.idCostCenter && w.idExpensesType == newSAPDataExpense.idExpensesType).ToList(); if (checkSAPDataExpenses.Count > 0) { hasNotErrorInRow = false; if (dictErrorsExpenses.ContainsKey("DuplicateOldExpenses")) { dictErrorsExpenses["DuplicateOldExpenses"] += "," + j + "-" + i; } else { dictErrorsExpenses.Add("DuplicateOldExpenses", j + "-" + i); } } if (hasNotErrorInRow) { listSAPDataExpenseNew.Add(newSAPDataExpense); // this.dbContext.SAPDataExpenses.AddObject(newSAPDataExpense); } } for (int j = 2; j < listKeyValueQuantityType.Count + 2; j++) { hasNotErrorInRow = true; currRow = 1; range = workSheetQuantity.Cells[currRow, i]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); var kvCostCenter = listKeyValueCostCenter.Where(w => w.Name.Trim().ToUpper() == rangeValueStr.Trim().ToUpper()).FirstOrDefault(); newSAPDataQuantity = new SAPDataQuantity(); newSAPDataQuantity.idSAPData = idEntity; if (kvCostCenter != null) { newSAPDataQuantity.idCostCenter = kvCostCenter.idKeyValue; } else { hasNotErrorInRow = false; if (dictErrorsQuantities.ContainsKey("CostCenterQuantity")) { dictErrorsQuantities["CostCenterQuantity"] += "," + i; } else { dictErrorsQuantities.Add("CostCenterQuantity", i.ToString()); } } currCol = 2; range = workSheetQuantity.Cells[j, currCol]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); var kvQuantityType = listKeyValueQuantityType.Where(w => w.KeyValueIntCode.Trim().ToUpper() == rangeValueStr.Trim().ToUpper()).FirstOrDefault(); if (kvQuantityType != null) { newSAPDataQuantity.idQuantityType = kvQuantityType.idKeyValue; } else { hasNotErrorInRow = false; if (dictErrorsQuantities.ContainsKey("QuantityType")) { dictErrorsQuantities["QuantityType"] += "," + j; } else { dictErrorsQuantities.Add("QuantityType", j.ToString()); } } range = workSheetQuantity.Cells[j, i]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); res = Decimal.TryParse(rangeValueStr, NumberStyles.Any, BaseHelper.GetNumberFormatInfo("", ".", 4), out resultParseDecimal); if (res) { newSAPDataQuantity.ValueData = resultParseDecimal; } else { newSAPDataQuantity.ValueData = decimal.Zero; } var checkSAPDataQuantity = listSAPDataQuantityOld.Where(w => w.idCostCenter == newSAPDataQuantity.idCostCenter && w.idQuantityType == newSAPDataQuantity.idQuantityType).ToList(); if (checkSAPDataQuantity.Count > 0) { hasNotErrorInRow = false; if (dictErrorsQuantities.ContainsKey("DuplicateOldQuantity")) { dictErrorsQuantities["DuplicateOldQuantity"] += "," + j + "-" + i; } else { dictErrorsQuantities.Add("DuplicateOldQuantity", j + "-" + i); } } if (hasNotErrorInRow) { listSAPDataQuantityNew.Add(newSAPDataQuantity); // this.dbContext.SAPDataQuantities.AddObject(newSAPDataQuantity); } } } if (dictErrorsExpenses.Count == 0 && dictErrorsQuantities.Count == 0) { resultContext = new SAPDataExpensesBL().EntitySave <SAPDataExpense>(listSAPDataExpenseNew, resultContext); if (resultContext.ResultCode == ETEMEnums.ResultEnum.Success) { resultContext = new SAPDataQuantityBL().EntitySave <SAPDataQuantity>(listSAPDataQuantityNew, resultContext); if (resultContext.ResultCode == ETEMEnums.ResultEnum.Success) { resultContext.ResultCode = ETEMEnums.ResultEnum.Success; resultContext.Message = "The SAP data expenses and quantities by cost centers have been imported successfully!"; } else { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; resultContext.Message = "Error import the SAP data expenses and quantities by cost centers!"; } } else { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; resultContext.Message = "Error import the SAP data expenses and quantities by cost centers!"; } } else { List <string> listErrors = new List <string>(); if (dictErrorsExpenses.ContainsKey("CostCenterExpenses")) { listErrors.Add("Error! The field `Cost Center` for expenses is missing or in wrong format, Cols (" + dictErrorsExpenses["CostCenterExpenses"] + ")!"); } if (dictErrorsExpenses.ContainsKey("ExpensesType")) { listErrors.Add("Error! The field `Expenses Type` is missing or in wrong format, Rows (" + dictErrorsExpenses["ExpensesType"] + ")!"); } if (dictErrorsExpenses.ContainsKey("DuplicateOldExpenses")) { listErrors.Add("Error! The selected file includes expenses with duplicate data in the database, Rows-Cols (" + dictErrorsExpenses["DuplicateOldExpenses"] + ")!"); } if (dictErrorsQuantities.ContainsKey("CostCenterQuantity")) { listErrors.Add("Error! The field `Cost Center` for quantities is missing or in wrong format, Cols (" + dictErrorsQuantities["CostCenterQuantity"] + ")!"); } if (dictErrorsQuantities.ContainsKey("QuantityType")) { listErrors.Add("Error! The field `Quantity Type` is missing or in wrong format, Rows (" + dictErrorsQuantities["QuantityType"] + ")!"); } if (dictErrorsQuantities.ContainsKey("DuplicateOldQuantity")) { listErrors.Add("Error! The selected file includes quantities with duplicate data in the database, Rows-Cols (" + dictErrorsQuantities["DuplicateOldQuantity"] + ")!"); } resultContext.Message = string.Join(Constants.ERROR_MESSAGES_SEPARATOR, listErrors); } } } catch (Exception ex) { resultContext.Message = "Error import the SAP data expenses and quantities by cost centers!"; BaseHelper.Log("Error import entities `SAPDataExpenses`, `SAPDataQuantity`!"); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } return(resultContext); }
public ActionResult GetQuestionTypeList(PageParam pageParam) { BaseHelper <QuestionType> helper = new BaseHelper <QuestionType>(); return(Success(helper.GetPageList <int, SearchModel>(null, o => o.OrderIndex, pageParam, true))); }
public CallContext SAPDataDelete(List <int> listSelectedIDs, CallContext resultContext) { try { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; List <SAPData> listSAPDatas = new List <SAPData>(); List <SAPDataExpense> listSAPDataExpenses = new List <SAPDataExpense>(); List <SAPDataQuantity> listSAPDataQuantities = new List <SAPDataQuantity>(); List <SAPDataCostCenterTotal> listSAPDataCostCenterTotals = new List <SAPDataCostCenterTotal>(); listSAPDatas = (from sd in this.dbContext.SAPDatas where listSelectedIDs.Contains(sd.idSAPData) select sd).ToList(); listSAPDataExpenses = (from sde in this.dbContext.SAPDataExpenses where listSelectedIDs.Contains(sde.idSAPData) select sde).ToList(); listSAPDataQuantities = (from sdq in this.dbContext.SAPDataQuantities where listSelectedIDs.Contains(sdq.idSAPData) select sdq).ToList(); listSAPDataCostCenterTotals = (from sdcct in this.dbContext.SAPDataCostCenterTotals where listSelectedIDs.Contains(sdcct.idSAPData) select sdcct).ToList(); CallContext deleteContext = new CallContext(); deleteContext = resultContext; deleteContext = new SAPDataCostCenterTotalBL().EntityDelete <SAPDataCostCenterTotal>(listSAPDataCostCenterTotals, deleteContext); if (deleteContext.ResultCode == ETEMEnums.ResultEnum.Success) { deleteContext = new SAPDataQuantityBL().EntityDelete <SAPDataQuantity>(listSAPDataQuantities, deleteContext); if (deleteContext.ResultCode == ETEMEnums.ResultEnum.Success) { deleteContext = new SAPDataExpensesBL().EntityDelete <SAPDataExpense>(listSAPDataExpenses, deleteContext); if (deleteContext.ResultCode == ETEMEnums.ResultEnum.Success) { deleteContext = base.EntityDelete <SAPData>(listSAPDatas, deleteContext); if (deleteContext.ResultCode == ETEMEnums.ResultEnum.Success) { resultContext.ResultCode = ETEMEnums.ResultEnum.Success; resultContext.Message = "Selected rows `SAP Data by Cost Centers` and their expenses and quantities have been deleted successfully!"; } else { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; resultContext.Message = "Error delete selected rows `SAP Data by Cost Centers` and their expenses and quantities!"; } } else { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; resultContext.Message = "Error delete `Expenses by Cost Centers` for selected rows `SAP Data by Cost Centers`!"; } } else { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; resultContext.Message = "Error delete `Quantities by Cost Centers` for selected rows `SAP Data by Cost Centers`!"; } } else { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; resultContext.Message = "Error delete `Totals by Cost Centers` for selected rows `SAP Data by Cost Centers`!"; } } catch (Exception ex) { resultContext.Message = "Error delete selected rows `SAP Data by Cost Centers` and their expenses and quantities!"; BaseHelper.Log("Error delete entities `SAPData`, IDs - (" + string.Join(",", listSelectedIDs.ToArray()) + ")!"); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } return(resultContext); }
public Dictionary <string, TableRow[]> LoadSAPDataExpensesAndQuantities(int idEntity, CallContext resultContext) { Dictionary <string, TableRow[]> result = new Dictionary <string, TableRow[]>(); try { List <string> listKeyTypeIntCodes = new List <string>() { ETEMEnums.KeyTypeEnum.CostCenter.ToString(), ETEMEnums.KeyTypeEnum.ExpensesType.ToString(), ETEMEnums.KeyTypeEnum.ExpensesTypeGroup.ToString(), ETEMEnums.KeyTypeEnum.QuantityType.ToString() }; List <KeyValueDataView> listKeyValuesToSAPDataExpensesAndQuantity = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueCostCenter = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueExpensesType = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueExpensesTypeGroup = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueQuantityType = new List <KeyValueDataView>(); listKeyValuesToSAPDataExpensesAndQuantity = (from kv in this.dbContext.KeyValues join kt in this.dbContext.KeyTypes on kv.idKeyType equals kt.idKeyType where listKeyTypeIntCodes.Contains(kt.KeyTypeIntCode) orderby kv.V_Order ascending select new KeyValueDataView { idKeyValue = kv.idKeyValue, Name = kv.Name, NameEN = kv.NameEN, DefaultValue1 = kv.DefaultValue1, KeyValueIntCode = kv.KeyValueIntCode, KeyTypeIntCode = kt.KeyTypeIntCode } ).ToList <KeyValueDataView>(); listKeyValueCostCenter = listKeyValuesToSAPDataExpensesAndQuantity.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.CostCenter.ToString()).ToList(); listKeyValueExpensesType = listKeyValuesToSAPDataExpensesAndQuantity.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.ExpensesType.ToString()).ToList(); listKeyValueExpensesTypeGroup = listKeyValuesToSAPDataExpensesAndQuantity.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.ExpensesTypeGroup.ToString()).ToList(); listKeyValueQuantityType = listKeyValuesToSAPDataExpensesAndQuantity.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.QuantityType.ToString()).ToList(); SAPData currSAPData = GetEntityById(idEntity); List <SAPDataExpense> listSAPDataExpenses = currSAPData.SAPDataExpenses.ToList <SAPDataExpense>(); List <SAPDataQuantity> listSAPDataQuantities = currSAPData.SAPDataQuantities.ToList <SAPDataQuantity>(); int countRows = 2 + listKeyValueExpensesType.Count + 3 + listKeyValueExpensesTypeGroup.Count + 3 + listKeyValueQuantityType.Count + 3 + listKeyValueExpensesTypeGroup.Count + 1; TableRow[] arrExpenses = new TableRow[countRows]; TableRow[] arrExpensesTypeGroup = new TableRow[listKeyValueExpensesTypeGroup.Count + 1]; TableRow[] arrQuantites = new TableRow[listKeyValueQuantityType.Count + 1]; TableRow[] arrExpensesTypeGroupMH = new TableRow[listKeyValueExpensesTypeGroup.Count + 2]; TableRow tableRow = new TableRow(); TableCell tableCell = new TableCell(); TableHeaderRow tableHeaderRow = new TableHeaderRow(); TableHeaderCell tableHeaderCell = new TableHeaderCell(); int rowIndex = 0; #region Detailed Expenses by Cost Centers (EUR) tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Expenses by Cost Centers (EUR)"; tableHeaderCell.ColumnSpan = 12; tableHeaderCell.CssClass = "GridExpenses_tr_th_Main"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex++] = tableHeaderRow; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Detailed Expenses"; tableHeaderCell.Width = Unit.Pixel(320); tableHeaderCell.CssClass = "GridExpenses_td_item_center"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex] = tableHeaderRow; // Add header columns foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = kvCostCenter.Name; tableHeaderCell.CssClass = "GridExpenses_td_item_center"; arrExpenses[rowIndex].Cells.Add(tableHeaderCell); } rowIndex++; // Add header rows foreach (KeyValueDataView kvExpensesType in listKeyValueExpensesType) { tableRow = new TableRow(); tableCell = new TableCell(); tableCell.Text = kvExpensesType.Name; tableRow.Cells.Add(tableCell); arrExpenses[rowIndex++] = tableRow; } rowIndex = rowIndex - listKeyValueExpensesType.Count; foreach (KeyValueDataView kvExpensesType in listKeyValueExpensesType) { foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableCell = new TableCell(); tableCell.HorizontalAlign = HorizontalAlign.Right; tableCell.CssClass = "GridExpenses_td_item_right"; var currExpense = listSAPDataExpenses.Where(w => w.idExpensesType == kvExpensesType.idKeyValue && w.idCostCenter == kvCostCenter.idKeyValue).FirstOrDefault(); if (currExpense != null) { tableCell.Text = currExpense.ValueDataRoundFormatted; arrExpenses[rowIndex].Cells.Add(tableCell); } } rowIndex++; } #endregion #region Expenses by Cost Centers (EUR) //rowIndex = 0; //rowIndex++; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.ColumnSpan = 12; tableHeaderCell.CssClass = "GridExpenses_tr_th_Empty"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex++] = tableHeaderRow; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Expenses by Cost Centers (EUR)"; tableHeaderCell.ColumnSpan = 12; tableHeaderCell.CssClass = "GridExpenses_tr_th_Main"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex++] = tableHeaderRow; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Expenses"; tableHeaderCell.Width = Unit.Pixel(320); tableHeaderCell.CssClass = "GridExpenses_td_item_center"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex] = tableHeaderRow; // Add header columns foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = kvCostCenter.Name; tableHeaderCell.CssClass = "GridExpenses_td_item_center"; arrExpenses[rowIndex].Cells.Add(tableHeaderCell); } rowIndex++; // Add header rows foreach (KeyValueDataView kvExpensesTypeGroup in listKeyValueExpensesTypeGroup) { tableRow = new TableRow(); tableCell = new TableCell(); tableCell.Text = kvExpensesTypeGroup.Name.Replace(" group", ""); tableRow.Cells.Add(tableCell); arrExpenses[rowIndex++] = tableRow; } List <Expense> listGroupExpense = new List <Expense>(); listGroupExpense = new ExpenseCalculationBL().LoadExpenseGroupByIdSAPData(idEntity); rowIndex = rowIndex - listKeyValueExpensesTypeGroup.Count; foreach (KeyValueDataView kvExpensesTypeGroup in listKeyValueExpensesTypeGroup) { foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableCell = new TableCell(); tableCell.HorizontalAlign = HorizontalAlign.Right; tableCell.CssClass = "GridExpenses_td_item_right"; var currGroupExpense = listGroupExpense.Where(w => w.ExpenseGroup.idKeyValue == kvExpensesTypeGroup.idKeyValue && w.CostCenter.idKeyValue == kvCostCenter.idKeyValue).FirstOrDefault(); if (currGroupExpense != null) { tableCell.Text = currGroupExpense.ExpenseValueRoundFour.ToStringFormatted4(); arrExpenses[rowIndex].Cells.Add(tableCell); } } rowIndex++; } #endregion #region Quantity // rowIndex = 0; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.ColumnSpan = 12; tableHeaderCell.CssClass = "GridExpenses_tr_th_Empty"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex++] = tableHeaderRow; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Quantity"; tableHeaderCell.ColumnSpan = 12; tableHeaderCell.CssClass = "GridExpenses_tr_th_Main"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex++] = tableHeaderRow; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Quantity"; tableHeaderCell.Width = Unit.Pixel(320); tableHeaderCell.CssClass = "GridExpenses_td_item_center"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex] = tableHeaderRow; // Add header columns foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = kvCostCenter.Name; tableHeaderCell.CssClass = "GridExpenses_td_item_center"; arrExpenses[rowIndex].Cells.Add(tableHeaderCell); } rowIndex++; // Add header rows foreach (KeyValueDataView kvQuantityType in listKeyValueQuantityType) { tableRow = new TableRow(); tableCell = new TableCell(); tableCell.Text = kvQuantityType.Name; tableRow.Cells.Add(tableCell); arrExpenses[rowIndex++] = tableRow; } rowIndex = rowIndex - listKeyValueQuantityType.Count; foreach (KeyValueDataView kvQuantityType in listKeyValueQuantityType) { foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableCell = new TableCell(); tableCell.HorizontalAlign = HorizontalAlign.Right; tableCell.CssClass = "GridExpenses_td_item_right"; var currQuantity = listSAPDataQuantities.Where(w => w.idQuantityType == kvQuantityType.idKeyValue && w.idCostCenter == kvCostCenter.idKeyValue).FirstOrDefault(); if (currQuantity != null) { tableCell.Text = currQuantity.ValueDataRoundFormatted; arrExpenses[rowIndex].Cells.Add(tableCell); } } rowIndex++; } #endregion #region Expenses by Cost Centers (EUR/MH) // rowIndex = 0; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.ColumnSpan = 12; tableHeaderCell.CssClass = "GridExpenses_tr_th_Empty"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex++] = tableHeaderRow; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Expenses by Cost Centers (EUR/MH)"; tableHeaderCell.ColumnSpan = 12; tableHeaderCell.CssClass = "GridExpenses_tr_th_Main"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex++] = tableHeaderRow; tableHeaderRow = new TableHeaderRow(); tableHeaderCell = new TableHeaderCell(); tableHeaderCell.Text = "Expenses"; tableHeaderCell.Width = Unit.Pixel(320); tableHeaderCell.CssClass = "GridExpenses_td_item_center"; tableHeaderRow.Cells.Add(tableHeaderCell); arrExpenses[rowIndex] = tableHeaderRow; // Add header columns foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableHeaderCell = new TableHeaderCell(); if (kvCostCenter.KeyValueIntCode == ETEMEnums.CostCenterEnum.DIESDepartment.ToString()) { tableHeaderCell.Text = kvCostCenter.Name + "<br/>" + "(EUR/kg)"; } else { tableHeaderCell.Text = kvCostCenter.Name; } tableHeaderCell.CssClass = "GridExpenses_td_item_center"; arrExpenses[rowIndex].Cells.Add(tableHeaderCell); } rowIndex++; // Add header rows foreach (KeyValueDataView kvExpensesTypeGroup in listKeyValueExpensesTypeGroup) { tableRow = new TableRow(); tableCell = new TableCell(); tableCell.Text = kvExpensesTypeGroup.Name.Replace(" group", ""); tableRow.Cells.Add(tableCell); arrExpenses[rowIndex++] = tableRow; } TableRow tableFooterRow = new TableRow(); tableCell = new TableCell(); tableCell.Text = "Total (EUR/MH)"; tableCell.CssClass = "GridExpenses_td_item_total"; tableFooterRow.Cells.Add(tableCell); arrExpenses[rowIndex] = tableFooterRow; //tableHeaderCell = new TableHeaderCell(); //tableHeaderCell.Text = "Total (EUR/MH)"; //tableHeaderCell.Font.Bold = true; //arrExpensesTypeGroupMH[0].Cells.Add(tableHeaderCell); listGroupExpense = new List <Expense>(); listGroupExpense = new ExpenseCalculationBL().LoadExpenseGroupByIdSAPData(idEntity); Dictionary <string, decimal> dictTotalByColl = new Dictionary <string, decimal>(); decimal totalByRow = decimal.Zero; decimal total = decimal.Zero; decimal currValue = decimal.Zero; rowIndex = rowIndex - (listKeyValueExpensesTypeGroup.Count + 0); foreach (KeyValueDataView kvExpensesTypeGroup in listKeyValueExpensesTypeGroup) { totalByRow = decimal.Zero; foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableCell = new TableCell(); tableCell.HorizontalAlign = HorizontalAlign.Right; tableCell.CssClass = "GridExpenses_td_item_right"; var currGroupExpense = listGroupExpense.Where(w => w.ExpenseGroup.idKeyValue == kvExpensesTypeGroup.idKeyValue && w.CostCenter.idKeyValue == kvCostCenter.idKeyValue).FirstOrDefault(); if (currGroupExpense != null) { currValue = currGroupExpense.ExpenseValue_MH_RoundFour; totalByRow += currValue; total += currValue; if (dictTotalByColl.ContainsKey(kvCostCenter.KeyValueIntCode)) { dictTotalByColl[kvCostCenter.KeyValueIntCode] += currValue; } else { dictTotalByColl.Add(kvCostCenter.KeyValueIntCode, currValue); } tableCell.Text = currValue.ToStringFormatted4(); arrExpenses[rowIndex].Cells.Add(tableCell); } } //tableCell = new TableCell(); //tableCell.HorizontalAlign = HorizontalAlign.Right; //tableCell.CssClass = "MainGrid_td_item_right"; //tableCell.Font.Bold = true; //tableCell.Text = totalByRow.ToStringFormatted(); //arrExpensesTypeGroupMH[rowIndex].Cells.Add(tableCell); rowIndex++; } foreach (KeyValueDataView kvCostCenter in listKeyValueCostCenter) { tableCell = new TableCell(); tableCell.HorizontalAlign = HorizontalAlign.Right; tableCell.CssClass = "GridExpenses_td_item_right GridExpenses_td_item_total"; tableCell.Text = Math.Round(dictTotalByColl[kvCostCenter.KeyValueIntCode], 4, MidpointRounding.AwayFromZero).ToStringFormatted4(); arrExpenses[rowIndex].Cells.Add(tableCell); } //tableCell = new TableCell(); //tableCell.HorizontalAlign = HorizontalAlign.Right; //tableCell.CssClass = "MainGrid_td_item_right"; //tableCell.Font.Bold = true; //tableCell.Text = total.ToStringFormatted(); //arrExpensesTypeGroupMH[rowIndex].Cells.Add(tableCell); #endregion result.Add("Expenses", arrExpenses); result.Add("ExpensesTypeGroup", arrExpensesTypeGroup); result.Add("Quantities", arrQuantites); result.Add("ExpensesTypeGroupMH", arrExpensesTypeGroupMH); } catch (Exception ex) { resultContext.Message = "Error load SAP data expenses and quantities!"; BaseHelper.Log("Error load SAP data expenses and quantities!"); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } return(result); }
public CallContext ImportDiePriceListDetails(string fileFullName, int idEntity, CallContext resultContext) { try { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; FileInfo excelFile = new FileInfo(fileFullName); using (ExcelPackage package = new ExcelPackage(excelFile)) { int currRow = 1; int currCol = 0; bool res; decimal resultParseDecimal; int resultParseInt; ExcelWorksheet workSheet = package.Workbook.Worksheets.FirstOrDefault(); if (workSheet == null) { resultContext.Message = "Error! No Excel work sheet!"; return(resultContext); } DiePriceList diePriceList = this.GetEntityById(idEntity); if (diePriceList == null) { resultContext.Message = "Entity `DiePriceList` not found by ID (" + idEntity + ")!"; return(resultContext); } List <string> listKeyTypeIntCodes = new List <string>() { ETEMEnums.KeyTypeEnum.NumberOfCavities.ToString(), ETEMEnums.KeyTypeEnum.ProfileCategory.ToString(), ETEMEnums.KeyTypeEnum.ProfileComplexity.ToString() }; List <KeyValueDataView> listKeyValuesToDiePriceListDetail = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueNumberOfCavities = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueProfileCategory = new List <KeyValueDataView>(); List <KeyValueDataView> listKeyValueProfileComplexity = new List <KeyValueDataView>(); listKeyValuesToDiePriceListDetail = (from kv in this.dbContext.KeyValues join kt in this.dbContext.KeyTypes on kv.idKeyType equals kt.idKeyType where listKeyTypeIntCodes.Contains(kt.KeyTypeIntCode) select new KeyValueDataView { idKeyValue = kv.idKeyValue, Name = kv.Name, NameEN = kv.NameEN, DefaultValue1 = kv.DefaultValue1, KeyValueIntCode = kv.KeyValueIntCode, KeyTypeIntCode = kt.KeyTypeIntCode } ).ToList <KeyValueDataView>(); listKeyValueNumberOfCavities = listKeyValuesToDiePriceListDetail.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.NumberOfCavities.ToString()).ToList(); listKeyValueProfileCategory = listKeyValuesToDiePriceListDetail.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.ProfileCategory.ToString()).ToList(); listKeyValueProfileComplexity = listKeyValuesToDiePriceListDetail.Where(w => w.KeyTypeIntCode == ETEMEnums.KeyTypeEnum.ProfileComplexity.ToString()).ToList(); List <DiePriceListDetail> listDiePriceListDetailsOld = new List <DiePriceListDetail>(); List <DiePriceListDetail> listDiePriceListDetailsNew = new List <DiePriceListDetail>(); listDiePriceListDetailsOld = (from dpld in this.dbContext.DiePriceListDetails where dpld.idDiePriceList == diePriceList.idDiePriceList select dpld).ToList <DiePriceListDetail>(); Dictionary <string, string> dictErrorsRows = new Dictionary <string, string>(); DiePriceListDetail newDiePriceListDetail = new DiePriceListDetail(); bool hasNotErrorInRow = true; string rangeValueStr = string.Empty; ExcelRange range; for (; ;) { currRow++; hasNotErrorInRow = true; currCol = 1; range = workSheet.Cells[currRow, currCol]; if (string.IsNullOrWhiteSpace(workSheet.Cells[currRow, 1].Text) && string.IsNullOrWhiteSpace(workSheet.Cells[currRow, 2].Text) && string.IsNullOrWhiteSpace(workSheet.Cells[currRow, 3].Text) && string.IsNullOrWhiteSpace(workSheet.Cells[currRow, 4].Text) && string.IsNullOrWhiteSpace(workSheet.Cells[currRow, 5].Text) && string.IsNullOrWhiteSpace(workSheet.Cells[currRow, 6].Text)) { break; } newDiePriceListDetail = new DiePriceListDetail(); newDiePriceListDetail.idDiePriceList = idEntity; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); var numberOfCavities = listKeyValueNumberOfCavities.Where(w => w.DefaultValue1.Trim().ToUpper() == rangeValueStr.Trim().ToUpper()).FirstOrDefault(); if (numberOfCavities != null) { newDiePriceListDetail.idNumberOfCavities = numberOfCavities.idKeyValue; } else { hasNotErrorInRow = false; if (dictErrorsRows.ContainsKey("NumberOfCavities")) { dictErrorsRows["NumberOfCavities"] += "," + currRow; } else { dictErrorsRows.Add("NumberOfCavities", currRow.ToString()); } } currCol++; range = workSheet.Cells[currRow, currCol]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); string[] arrRangeValue = rangeValueStr.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries); string profileComplexityVal = (arrRangeValue.Length > 0 ? arrRangeValue[0] : string.Empty); string profileCategoryVal = (arrRangeValue.Length > 1 ? arrRangeValue[1] : string.Empty); var profileComplexity = listKeyValueProfileComplexity.Where(w => w.Name.Trim().ToUpper() == profileComplexityVal.Trim().ToUpper()).FirstOrDefault(); if (profileComplexity != null) { newDiePriceListDetail.idProfileComplexity = profileComplexity.idKeyValue; } else { hasNotErrorInRow = false; if (dictErrorsRows.ContainsKey("ProfileComplexity")) { dictErrorsRows["ProfileComplexity"] += "," + currRow; } else { dictErrorsRows.Add("ProfileComplexity", currRow.ToString()); } } var profileCategory = listKeyValueProfileCategory.Where(w => w.Name.Trim().ToUpper() == profileCategoryVal.Trim().ToUpper()).FirstOrDefault(); if (profileCategory != null) { newDiePriceListDetail.idProfileCategory = profileCategory.idKeyValue; } else { hasNotErrorInRow = false; if (dictErrorsRows.ContainsKey("ProfileCategory")) { dictErrorsRows["ProfileCategory"] += "," + currRow; } else { dictErrorsRows.Add("ProfileCategory", currRow.ToString()); } } currCol++; currCol++; range = workSheet.Cells[currRow, currCol]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); res = Decimal.TryParse(rangeValueStr, NumberStyles.Any, BaseHelper.GetNumberFormatInfo("", ".", 2), out resultParseDecimal); if (res) { newDiePriceListDetail.Price = resultParseDecimal; } else { hasNotErrorInRow = false; newDiePriceListDetail.Price = decimal.MinValue; if (dictErrorsRows.ContainsKey("Price")) { dictErrorsRows["Price"] += "," + currRow; } else { dictErrorsRows.Add("Price", currRow.ToString()); } } currCol++; range = workSheet.Cells[currRow, currCol]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); res = Int32.TryParse(rangeValueStr, NumberStyles.Any, BaseHelper.GetNumberFormatInfo("", ".", 0), out resultParseInt); if (res) { newDiePriceListDetail.DimensionA = resultParseInt; } else { hasNotErrorInRow = false; newDiePriceListDetail.DimensionA = int.MinValue; if (dictErrorsRows.ContainsKey("DimensionA")) { dictErrorsRows["DimensionA"] += "," + currRow; } else { dictErrorsRows.Add("DimensionA", currRow.ToString()); } } currCol++; range = workSheet.Cells[currRow, currCol]; rangeValueStr = (range.Value != null ? range.Value.ToString() : string.Empty); res = Int32.TryParse(rangeValueStr, NumberStyles.Any, BaseHelper.GetNumberFormatInfo("", ".", 0), out resultParseInt); if (res) { newDiePriceListDetail.DimensionB = resultParseInt; } else { hasNotErrorInRow = false; newDiePriceListDetail.DimensionB = int.MinValue; if (dictErrorsRows.ContainsKey("DimensionB")) { dictErrorsRows["DimensionB"] += "," + currRow; } else { dictErrorsRows.Add("DimensionB", currRow.ToString()); } } newDiePriceListDetail.Lifespan = decimal.Zero; var checkDiePriceListDetail = listDiePriceListDetailsOld.Where(w => w.idNumberOfCavities == newDiePriceListDetail.idNumberOfCavities && w.idProfileComplexity == newDiePriceListDetail.idProfileComplexity && w.idProfileCategory == newDiePriceListDetail.idProfileCategory && w.Price == newDiePriceListDetail.Price && w.DimensionA == newDiePriceListDetail.DimensionA && w.DimensionB == newDiePriceListDetail.DimensionB).ToList(); if (checkDiePriceListDetail.Count > 0) { hasNotErrorInRow = false; if (dictErrorsRows.ContainsKey("DuplicateOld")) { dictErrorsRows["DuplicateOld"] += "," + currRow; } else { dictErrorsRows.Add("DuplicateOld", currRow.ToString()); } } checkDiePriceListDetail = listDiePriceListDetailsNew.Where(w => w.idNumberOfCavities == newDiePriceListDetail.idNumberOfCavities && w.idProfileComplexity == newDiePriceListDetail.idProfileComplexity && w.idProfileCategory == newDiePriceListDetail.idProfileCategory && w.Price == newDiePriceListDetail.Price && w.DimensionA == newDiePriceListDetail.DimensionA && w.DimensionB == newDiePriceListDetail.DimensionB).ToList(); if (checkDiePriceListDetail.Count > 0) { hasNotErrorInRow = false; if (dictErrorsRows.ContainsKey("DuplicateNew")) { dictErrorsRows["DuplicateNew"] += "," + currRow; } else { dictErrorsRows.Add("DuplicateNew", currRow.ToString()); } } if (hasNotErrorInRow) { listDiePriceListDetailsNew.Add(newDiePriceListDetail); // this.dbContext.DiePriceListDetails.AddObject(newDiePriceListDetail); } } if (dictErrorsRows.Count == 0) { resultContext = new DiePriceListDetailBL().EntitySave <DiePriceListDetail>(listDiePriceListDetailsNew, resultContext); if (resultContext.ResultCode == ETEMEnums.ResultEnum.Success) { resultContext.ResultCode = ETEMEnums.ResultEnum.Success; resultContext.Message = "The details for current `Die Price List by Vendor` have been imported successfully!"; } else { resultContext.ResultCode = ETEMEnums.ResultEnum.Error; resultContext.Message = "Error import details for current `Die Price List by Vendor`!"; } } else { List <string> listErrors = new List <string>(); if (dictErrorsRows.ContainsKey("NumberOfCavities")) { listErrors.Add("Error! The field `cavities` is missing or in wrong format, Rows (" + dictErrorsRows["NumberOfCavities"] + ")!"); } if (dictErrorsRows.ContainsKey("ProfileComplexity")) { listErrors.Add("Error! The field `complexity` is missing or in wrong format, Rows (" + dictErrorsRows["ProfileComplexity"] + ")!"); } if (dictErrorsRows.ContainsKey("ProfileCategory")) { listErrors.Add("Error! The field `category` is missing or in wrong format, Rows (" + dictErrorsRows["ProfileCategory"] + ")!"); } if (dictErrorsRows.ContainsKey("Price")) { listErrors.Add("Error! The field `price` is missing or in wrong NUMBER format, Rows (" + dictErrorsRows["Price"] + ")!"); } if (dictErrorsRows.ContainsKey("DimensionA")) { listErrors.Add("Error! The field `dimensiona` is missing or in wrong INTEGER NUMBER format, Rows (" + dictErrorsRows["DimensionA"] + ")!"); } if (dictErrorsRows.ContainsKey("DimensionB")) { listErrors.Add("Error! The field `dimensionb` is missing or in wrong INTEGER NUMBER format, Rows (" + dictErrorsRows["DimensionB"] + ")!"); } if (dictErrorsRows.ContainsKey("DuplicateNew")) { listErrors.Add("Error! The selected file includes die price list details with duplicate values, Rows (" + dictErrorsRows["DuplicateNew"] + ")!"); } if (dictErrorsRows.ContainsKey("DuplicateOld")) { listErrors.Add("Error! The selected file includes die price list details with duplicate values in the database, Rows (" + dictErrorsRows["DuplicateOld"] + ")!"); } resultContext.Message = string.Join(Constants.ERROR_MESSAGES_SEPARATOR, listErrors); } } } catch (Exception ex) { resultContext.Message = "Error import details for current `Die Price List by Vendor`!"; BaseHelper.Log("Error import entities `DiePriceListDetail`!"); BaseHelper.Log(ex.Message); BaseHelper.Log(ex.StackTrace); } return(resultContext); }
protected void btnImportPriceListDetails_Click(object sender, EventArgs e) { if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.DiePriceListImportDetails, false)) { return; } base.RunJavaScriptModalWindow(); if (this.fuImportPriceListDetails.HasFile) { string selectedFileMimeType = this.fuImportPriceListDetails.PostedFile.ContentType; string excelMimeType = BaseHelper.GetMimeType(Constants.FILE_XLSX_EXTENSION); if (!string.Equals(selectedFileMimeType, excelMimeType, StringComparison.InvariantCultureIgnoreCase)) { this.ownerPage.ShowMSG("Selected file is in incorrect format, it must be Excel-2007 or newer version!", false); return; } string fileFullName = string.Empty; string folderPath = string.Empty; folderPath = GeneralPage.GetSettingByCode(ETEMModel.Helpers.ETEMEnums.AppSettings.ResourcesFolderName).SettingValue; folderPath += "\\CostCalculation\\DiePriceList\\Import\\" + DateTime.Today.Year + "\\"; if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } fileFullName = folderPath + "\\Import_DiePriceListDetails_" + DateTime.Now.ToString(Constants.DATE_PATTERN_FOR_FILE_SUFFIX) + Constants.FILE_XLSX_EXTENSION; this.fuImportPriceListDetails.PostedFile.SaveAs(fileFullName); this.ownerPage.CallContext = this.ownerPage.CostCalculationRef.ImportDiePriceListDetails(fileFullName, this.hdnRowMasterKey.Value, this.ownerPage.CallContext); if (this.ownerPage.CallContext.ResultCode == ETEMEnums.ResultEnum.Success) { base.AddMessage(this.lbResultContext, this.ownerPage.CallContext.Message); } else { if (!ShowErrors(new List <CallContext>() { this.ownerPage.CallContext })) { return; } } } else { this.ownerPage.ShowMSG("Please select file to import!", false); } }
public ActionResult Ver() { ViewData["Video"] = BaseHelper.ejecutarConsulta("sp_Video_ConsultarTodo", CommandType.StoredProcedure); return(View()); }
protected void chbxCheckOrUncheckAll_OnCheckedChanged(object sender, EventArgs e) { CheckBox chbx = sender as CheckBox; BaseHelper.SelectOrDeselectAllEnabledGridCheckBox(this.gvAverageOutturnOverTimeList, chbx.Checked, "chbxCheckForDeletion"); }
public int ExecuteSql(string strSql) { return(BaseHelper.ExecuteNonQuery(strSql)); }
public ActionResult CustomerWiseReport() { var firstItem = new SelectListItem() { Text = Utilities.DefaultSelectionValue, Value = "0", Selected = true }; var subSector = new List <SelectListItem>(); var sector = new List <SelectListItem>(); var states = new List <SelectListItem>(); var cities = new List <SelectListItem>(); var typeOfService = new List <SelectListItem>(); var revenue = new List <SelectListItem>(); var assessMent = new List <SelectListItem>(); using (var repo = new Repository <Assessment>()) { assessMent = repo.All().Select(q => new SelectListItem() { Value = q.Id.ToString(), Text = q.Name }).ToList(); //subSector = repo.AssessmentContext.subSectors.Select(q => new SelectListItem() { Value = q.Id.ToString(), Text = q.SubSectorName }).ToList(); sector = BaseHelper.GetSectorValues(); states = repo.AssessmentContext.states.Select(q => new SelectListItem() { Value = q.Id.ToString(), Text = q.StateName }).ToList(); revenue = repo.AssessmentContext.revenues.Select(q => new SelectListItem() { Value = q.Id.ToString(), Text = q.Name }).ToList(); typeOfService = repo.AssessmentContext.serviceTypes.Select(q => new SelectListItem() { Value = q.Id.ToString(), Text = q.Name }).ToList(); cities = repo.AssessmentContext.cities.Select(q => new SelectListItem() { Value = q.Id.ToString(), Text = q.CityName }).ToList(); } var lastItem = new SelectListItem() { Text = Utilities.Others, Value = Utilities.OthersValue }; //sector.Insert(0, firstItem); //subSector.Insert(0, firstItem); revenue.Insert(0, firstItem); typeOfService.Insert(0, firstItem); cities.Insert(0, firstItem); states.Insert(0, firstItem); assessMent.Insert(0, firstItem); //sector.Add(lastItem); //subSector.Add(lastItem); ViewBag.AssessMent = assessMent; ViewBag.SectorList = sector; ViewBag.SubSectorList = subSector; ViewBag.City = cities; ViewBag.State = states; ViewBag.Revenue = revenue; ViewBag.TypeOfService = typeOfService; return(View()); }
public DataTable ExecuteSqlDatatable(string sql) { return(BaseHelper.ExecuteTable(sql)); }
public string Notify(YeePayNotify yeePayNotify) { bool reuslt = false; StringBuilder sbLog = new StringBuilder(); try { //1.记录请求日志 //sbLog.Append("\r\n 1、请求参数:" + " notify(XML): " + yeePayNotify.notify + " \r\n sign: " + yeePayNotify.sign); // 1.记录请求日志(不记录签名数据,只记录XML数据) sbLog.Append("\r\n 1、请求参数:" + " notify(XML): " + yeePayNotify.notify); StringBuilder postData = new StringBuilder(); postData.Append("req=" + dataFornat.UrlEncode(yeePayNotify.notify)); //编码 postData.Append("&sign=" + dataFornat.UrlEncode(yeePayNotify.sign)); //编码 string strHttpPost = yeePay.HttpPost(yeePayConfig._verifyUrl, postData.ToString()); sbLog.Append("\r\n 2. 验证签名状态:" + strHttpPost); // 2. 验证签名 if (strHttpPost.Contains("SUCCESS")) { // 解析XML XElement root = XElement.Parse(yeePayNotify.notify); string bizType = root.Element("bizType").Value; string code = root.Element("code").Value; notify _baseNotify = null; #region 3.业务处理 if (code == ((int)EnumCode.CodeTrue).ToString()) { #region if (bizType == EnumNotifyBizType.REGISTER.ToEnumDesc()) //2.1 注册( 2.6企业注册) ok { _baseNotify = yeePayNotify.notify.XmlDeserialize <notify>(); //序列化 XML 转 实体 reuslt = yeePayOper.ToRegister(_baseNotify.platformUserNo); } else if (bizType == EnumNotifyBizType.RECHARGE.ToEnumDesc())//2.2 充值 ok { _baseNotify = yeePayNotify.notify.XmlDeserialize <notify>(); reuslt = yeePayOper.ToRecharge(_baseNotify.platformUserNo, _baseNotify.requestNo); } else if (bizType == EnumNotifyBizType.WITHDRAW.ToEnumDesc()) // 2.3 提现 ok { MoneyCarCar.Models.YeePay.NotifyModel.toWithdraw.notify _notify = yeePayNotify.notify.XmlDeserialize <MoneyCarCar.Models.YeePay.NotifyModel.toWithdraw.notify>(); reuslt = yeePayOper.ToWithdraw(_baseNotify.platformUserNo, _baseNotify.requestNo); } else if (bizType == EnumNotifyBizType.BIND_BANK_CARD.ToEnumDesc())// 2.4 绑卡 ok { MoneyCarCar.Models.YeePay.NotifyModel.toBindBankCard.notify _notify = yeePayNotify.notify.XmlDeserialize <MoneyCarCar.Models.YeePay.NotifyModel.toBindBankCard.notify>(); string BankName = _notify.bank.ToEnum <EnumBank>().ToEnumDesc(); reuslt = yeePayOper.ToBindBank(_notify.cardNo, BankName, _notify.platformUserNo, _notify.requestNo); } else if (bizType == EnumNotifyBizType.UNBIND_BANK_CARD.ToEnumDesc()) { //2.5 同步处理 } else if (bizType == EnumNotifyBizType.TRANSACTION.ToEnumDesc()) { //2.7 转账、投标、还款、债权转让 _baseNotify = yeePayNotify.notify.XmlDeserialize <notify>(); if (_baseNotify.status == EnumNotifyStatus.PREAUTH.ToEnumDesc()) { BaseHelper baseHelper = new BaseHelper(); // 调用存储过程 :业务处理 string errorMsg = ""; reuslt = yeePayOper.ToCpTransaction(_baseNotify.requestNo, out errorMsg); if (reuslt) { #region 自动调用转账确认 MoneyCarCar.Models.YeePay.RequestModel.Complete_Transaction complete_Transaction = new MoneyCarCar.Models.YeePay.RequestModel.Complete_Transaction(); complete_Transaction.platformUserNo = _baseNotify.platformUserNo; complete_Transaction.requestNo = _baseNotify.requestNo; complete_Transaction.mode = EnumModeCOMPLETETRANSACTION.CONFIRM.ToString(); BaseResultDto <MoneyCarCar.Models.YeePay.Response.COMPLETE_TRANSACTION.response> baseResultDtoResponse = new BaseResultDto <MoneyCarCar.Models.YeePay.Response.COMPLETE_TRANSACTION.response>(); YeePay yeepay = new YeePay(); baseResultDtoResponse = yeepay.COMPLETE_TRANSACTION(complete_Transaction); string str = baseResultDtoResponse.ErrorMsg;//XML 数据 #endregion } else { sbLog.Append("\r\n (2.7 转账、投标、还款、债权转让)业务处理失败,不自动调用<转账确认>接口"); } } else if (_baseNotify.status == EnumNotifyStatus.DIRECT.ToEnumDesc()) { // 3.4 直接转账(平台转款)、 _baseNotify = yeePayNotify.notify.XmlDeserialize <notify>(); YeePayOper yeep = new YeePayOper(); reuslt = yeep.Direct_Transaction(_baseNotify.requestNo); } else if (_baseNotify.status == EnumNotifyStatus.CONFIRM.ToEnumDesc()) { // 3.5 自动转账(自动还款)单独调用, 与 3.7 无关 _baseNotify = yeePayNotify.notify.XmlDeserialize <notify>(); YeePayOper yeep = new YeePayOper(); reuslt = yeep.Direct_Transaction(_baseNotify.requestNo); if (reuslt) { #region 自动调用转账确认 MoneyCarCar.Models.YeePay.RequestModel.Complete_Transaction complete_Transaction = new MoneyCarCar.Models.YeePay.RequestModel.Complete_Transaction(); complete_Transaction.platformUserNo = _baseNotify.platformUserNo; complete_Transaction.requestNo = _baseNotify.requestNo; complete_Transaction.mode = EnumModeCOMPLETETRANSACTION.CONFIRM.ToString(); BaseResultDto <MoneyCarCar.Models.YeePay.Response.COMPLETE_TRANSACTION.response> baseResultDtoResponse = new BaseResultDto <MoneyCarCar.Models.YeePay.Response.COMPLETE_TRANSACTION.response>(); YeePay yeepay = new YeePay(); baseResultDtoResponse = yeepay.COMPLETE_TRANSACTION(complete_Transaction); string str = baseResultDtoResponse.ErrorMsg;//XML 数据 #endregion } else { sbLog.Append("\r\n (3.5 自动转账)业务处理失败,不自动调用<转账确认>接口"); } } else { sbLog.Append("\r\n 验证状态(status)失败:不处理"); } } else if (bizType == EnumNotifyBizType.AUTHORIZE_AUTO_TRANSFER.ToEnumDesc()) { //2.8 转账授权 _baseNotify = yeePayNotify.notify.XmlDeserialize <notify>(); // 调用存储过程 :业务处理 } else if (bizType == EnumNotifyBizType.AUTHORIZE_AUTO_REPAYMENT.ToEnumDesc()) { //2.9. 自动还款授权 _baseNotify = yeePayNotify.notify.XmlDeserialize <notify>(); // 调用存储过程 :业务处理 } else { sbLog.Append("\r\n 验证状态(bizType)失败:不处理"); } #endregion } else { sbLog.Append("\r\n 验证状态(code)失败:不处理"); } #endregion } } catch (Exception e) { sbLog.Append("\r\n 业务处理异常(catch):" + e.ToString()); } finally { sbLog.Append("\r\n 返回状态:" + (reuslt == true ? "SUCCESS" : "FALE")); Log.RecordLog("YeePayNotifyController", sbLog.ToString(), false); } if (reuslt == true) { return("SUCCESS"); //成功 } else { return("FALE"); //失败 } }
/// <summary> /// 开始事务 /// </summary> public void BeginTransaction() { BaseHelper.BeginTransaction(); }
// // GET: /Video/ public ActionResult Index() { ViewData["video"] = BaseHelper.ejecutarConsulta("sp_video_verVideo2", CommandType.StoredProcedure); return(View()); }
/// <summary> /// 提交 /// </summary> public void Commit() { BaseHelper.Commit(); }
// // GET: /Video/ public ActionResult VerVideo() {//Consultar videos de la BD ViewData["video"] = BaseHelper.ejecutarConsulta( "SELECT * FROM video", CommandType.Text); return(View()); }
/// <summary> /// 回滚 /// </summary> public void RollBack() { BaseHelper.RollBack(); }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public ActionResult Create() { ViewData["video"] = BaseHelper.ejecutarConsulta( "SELECT * FROM video", CommandType.Text); return(View()); }
///// <summary> ///// 根据实体类的类型和主键值查询实体对象 ///// 使用 type 确定实体,主键确定数据的唯 ///// 一性 ///// </summary> ///// <param name="type">实体类型</param> ///// <param name="pkPropertyValue">主键值</param> ///// <returns></returns> //public object GetEntity(Type type, object pkPropertyValue) //{ // IDataParameter[] param = null; // string sql = Factory.CreateSingleSql(type,pkPropertyValue,out param); // using (IDbProvider provider = new SqlProvider()) // { // return baseHelper_.ConvertToEntity(type,BaseHelper.ExecuteDataReader(sql,param)); // } //} ///// <summary> ///// 根据某个实体的属性来查询实体对象 ///// 该属性值能确定数据库唯一数据行 ///// </summary> ///// <typeparam name="T">实体泛型类</typeparam> ///// <param name="propertyName">属性名称</param> ///// <param name="propertyValue">属性值</param> ///// <returns></returns> //public T GetEntity<T>(string propertyName, object propertyValue) where T : class //{ // IDataParameter[] param = null; // string sql = Factory.CreateQueryByPropertySql(typeof(T),propertyName,propertyValue,out param,null); // using (IDbProvider provider = new SqlProvider()) // { // return BaseHelper.ConvertToEntity<T>(BaseHelper.ExecuteDataReader(sql,param)); // } //} ///// <summary> ///// 根据某个实体的属性来查询实体对象 ///// 该属性值能确定数据库唯一数据行 ///// </summary> ///// <param name="type">实体类型</param> ///// <param name="propertyName">属性名称</param> ///// <param name="propertyValue">属性值</param> ///// <returns></returns> //public object GetEntity(Type type, string propertyName, object propertyValue) //{ // IDataParameter[] param = null; // string sql = Factory.CreateQueryByPropertySql(type, propertyName, propertyValue, out param,null); // using (IDbProvider provider = new SqlProvider()) // { // return BaseHelper.ConvertToEntity(type,BaseHelper.ExecuteDataReader(sql,param)); // } //} ///// <summary> ///// 根据某个实体的多个属性来查询实体对象 ///// </summary> ///// <typeparam name="T">泛型类</typeparam> ///// <param name="entity">实体公共接口</param> ///// <param name="propertyNames">属性名称数组</param> ///// <returns></returns> //public T GetEntity<T>(IEntity entity, string[] propertyNames) where T : class //{ // IDataParameter[] param = null; // string sql = Factory.CreateSingleSql(entity,out param,propertyNames); // using (IDbProvider provider = new SqlProvider()) // { // return BaseHelper.ConvertToEntity<T>(BaseHelper.ExecuteDataReader(sql,param)); // } //} ///// <summary> ///// 根据某个实体的多个属性来查询实体对象 ///// 实体根据type类型来确定 ///// </summary> ///// <param name="type">实体类型</param> ///// <param name="entity">实体公共接口</param> ///// <param name="propertyNames">属性名称数组</param> ///// <returns></returns> //public object GetEntity(Type type, IEntity entity, string[] propertyNames) //{ // IDataParameter[] param = null; // string sql = Factory.CreateSingleSql(type,entity,out param,propertyNames); // using (IDbProvider provider = new SqlProvider()) // { // return BaseHelper.ConvertToEntity(type,BaseHelper.ExecuteDataReader(sql,param)); // } //} /// <summary> /// 查询该类型实体数据行数 /// </summary> /// <param name="type">实体类型</param> /// <returns></returns> public int GetCount(Type type) { string sql = Factory.CreateConverageSql(type, Converage.Count); return((int)BaseHelper.ExecuteScalar(sql)); }
public ActionResult Delete(int idVideo) { BaseHelper.ejecutarSentencia("Delete * from Video where idVideo=@idVideo", CommandType.Text); return(View()); }
/// <summary> /// 查询该类型实体数据行数 /// </summary> /// <typeparam name="T">泛型类型</typeparam> /// <returns></returns> public int GetCount <T>() where T : class { string sql = Factory.CreateConverageSql(typeof(T), Converage.Count); return((int)BaseHelper.ExecuteScalar(sql)); }
// // GET: /Video/ public ActionResult Index() { ViewData["Video"] = BaseHelper.ejecutarConsulta("Select*from Video", CommandType.Text); return(View()); }
public ActionResult Index() { ViewBag.RoleList = BaseHelper.GetParentMenu(string.Empty); return(View()); }
protected override void OnInit(EventArgs e) { base.OnInit(e); helper = new BaseHelper(this.Page); }
public BasePage() { helper = new BaseHelper(this.Page); }