/// <summary> /// Generate installation history combobox /// </summary> /// <param name="helper"></param> /// <param name="id"></param> /// <param name="attribute"></param> /// <param name="include_idx0"></param> /// <returns></returns> public static MvcHtmlString InstallationHistoryComboBox(this HtmlHelper helper, string id, object attribute = null, bool include_idx0 = true) { List <tbt_InstallationHistory> lst = new List <tbt_InstallationHistory>(); try { IInstallationHandler handle = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; lst = handle.GetTbt_InstallationHistory(null, null, null); var sortedList = from p in lst orderby p.HistoryNo select p; lst = sortedList.ToList <tbt_InstallationHistory>(); //lst = (from p in lst orderby p.DistrictName ascending select p).ToList<tbm_District>(); } catch { lst = new List <tbt_InstallationHistory>(); } return(CommonUtil.CommonComboBox <tbt_InstallationHistory>(id, lst, "SlipNo", "SlipNo", attribute)); }
public void UpdateOperationOffice(string contractCode, string operationOfficeCode) { try { if (string.IsNullOrEmpty(contractCode) || string.IsNullOrEmpty(operationOfficeCode)) { return; } ISaleContractHandler saleHandler = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; var lstSales = saleHandler.GetTbt_SaleBasic(contractCode, null, null); if (lstSales != null && lstSales.Count > 0) { foreach (var sale in lstSales) { sale.OperationOfficeCode = operationOfficeCode; saleHandler.UpdateTbt_SaleBasic(sale); } } IQuotationHandler quotationHandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler; var lstQuotationTarget = quotationHandler.GetTbt_QuotationTargetByContractCode(contractCode); if (lstQuotationTarget != null && lstQuotationTarget.Count > 0) { foreach (var q in lstQuotationTarget) { quotationHandler.UpdateQuotationTarget(new doUpdateQuotationTargetData() { QuotationTargetCode = q.QuotationTargetCode, ContractTransferStatus = q.ContractTransferStatus, ContractCode = q.ContractCode, TransferDate = q.TransferDate, TransferAlphabet = q.TransferAlphabet, LastAlphabet = q.LastAlphabet, QuotationOfficeCode = q.QuotationTargetCode, OperationOfficeCode = operationOfficeCode, }); } } IInstallationHandler installHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; var lstInstallationBasic = installHandler.GetTbt_InstallationBasicData(contractCode); if (lstInstallationBasic != null && lstInstallationBasic.Count > 0) { foreach (var ib in lstInstallationBasic) { ib.OperationOfficeCode = operationOfficeCode; installHandler.UpdateTbt_InstallationBasic(ib); } } var lstInstallationHistory = installHandler.GetTbt_InstallationHistory(contractCode, null, null); if (lstInstallationHistory != null && lstInstallationHistory.Count > 0) { foreach (var ih in lstInstallationHistory) { ih.OperationOfficeCode = operationOfficeCode; } installHandler.UpdateTbt_InstallationHistory(lstInstallationHistory); } } catch (Exception ex) { throw ex; } }