private void CreateRecord(int formId, int productionUnitId) { decimal?salesNetAmount = GetDecimalValueFromInput(SalesNetAmountInput.Text, true); decimal?serviceDeliveryNetAmount = GetDecimalValueFromInput(ServiceDeliveryNetAmountInput.Text, true); decimal?costTotalAmount = GetDecimalValueFromInput(CostTotalAmountInput.Text, true); decimal?operacionalCostAmount = GetDecimalValueFromInput(OperacionalCostAmountInput.Text, true); decimal?productSalesNetAmountBudgeted = GetDecimalValueFromInput(ProductSalesNetAmountBudgetedInput.Text, true); decimal?serviceSalesNetAmountBudgeted = GetDecimalValueFromInput(ServiceSalesNetAmountBudgetedInput.Text, true); decimal?businessAmount = GetDecimalValueFromInput(BusinessAmountInput.Text, true); decimal?trainingAmount = GetDecimalValueFromInput(TrainingAmountInput.Text, true); decimal?salaryAmount = GetDecimalValueFromInput(SalaryAmountInput.Text, true); decimal?socialExpensesAmount = GetDecimalValueFromInput(SocialExpensesAmountInput.Text, true); decimal?otherPersonelCostsAmount = GetDecimalValueFromInput(OtherPersonelCostsAmountInput.Text, true); decimal?directLabourCostsAmount = GetDecimalValueFromInput(DirectLabourCostsAmountInput.Text, true); decimal?investmentValue = GetDecimalValueFromInput(InvestmentValueInput.Text, true); decimal?technologyInvestmentValue = GetDecimalValueFromInput(TechnologyInvestmentValueInput.Text, true); int productionAutomatedControlSystem = ddlProductionAutomatedControlSystem.SelectedValue == "1" ? 1 : 0; using (var db = new Models.SmizeeContext()) { FinancialForm entity = new FinancialForm(); entity.StateID = 1; entity.FormID = formId; entity.SalesNetAmount = salesNetAmount; entity.ServiceDeliveryNetAmount = serviceDeliveryNetAmount; entity.CostTotalAmount = costTotalAmount; entity.OperacionalCostAmount = operacionalCostAmount; entity.ProductSalesNetAmountBudgeted = productSalesNetAmountBudgeted; entity.ServiceSalesNetAmountBudgeted = serviceSalesNetAmountBudgeted; entity.BusinessAmount = businessAmount; entity.TrainingAmount = trainingAmount; entity.SalaryAmount = salaryAmount; entity.SocialExpensesAmount = socialExpensesAmount; entity.OtherPersonelCostsAmount = otherPersonelCostsAmount; entity.DirectLabourCostsAmount = directLabourCostsAmount; entity.InvestmentValue = investmentValue; entity.TechnologyInvestmentValue = technologyInvestmentValue; entity.ProductionAutomatedControlSystem = productionAutomatedControlSystem; entity.SubmitDate = DateTime.Now; //entity.ApprovalDate = DateTime.Parse("01/01/2000 00:00:00"); entity.SubmitUserName = User.Identity.Name; db.FinancialForms.Add(entity); db.SaveChanges(); } BackPanel.Visible = true; ConfirmButtonPanel.Visible = false; DetailPanel.Visible = false; ShowInfo(MessagePanel, Resources.Resource.mCreateOK); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetTransactionOptions(Options, true, false, false, false, false, false, false); SetPageDescription(Resources.MainMenu.IM_03_02); currentOption = Options.SelectedValue; string pu = Request.QueryString["PU"]; string fefid = Request.QueryString["FID"]; string stateid = Request.QueryString["ST"]; if (fefid != null) { CompanyFormID.Value = fefid; currentOption = "UPD"; OptionsPanel.Visible = false; SearchPanel.Visible = false; DetailPanel.Visible = true; ConfirmButtonPanel.Visible = true; FinancialForm entity = CxFinancialForm.GetFormById(int.Parse(fefid)); FormMessageLiteral.Text = GetPeriodMessage(Resources.Resource.lForm2Message, entity.PeriodNumber, entity.Form.Periodicity.Code, entity.FormDate); if (stateid == "3") { DetailPanel.Enabled = false; ApprovePanel.Visible = true; ConfirmButtonPanel.Visible = false; FormMessageLiteral.Text = ""; } ProductionUnitLiteral.Text = pu; FillDateLiteral.Text = DateTime.Now.ToShortDateString(); ShowCurrentForm(int.Parse(fefid)); } } else { currentOption = Options.SelectedValue; User user = WebSecurity.GetUserInfo(Page.User.Identity.Name); int? companyId = user.CompanyID; if (companyId != null && companyId != 0) { ddlCompany.SelectedValue = companyId.ToString(); ddlCompany.Enabled = false; } } }