internal int UpdateWorkOrderInfo(MRK_WorkOrder aMRK_WorkOrder, int workOrderId) { try { MRK_WorkOrder MRK_WorkOrder = _Context.MRK_WorkOrder.First(x => x.WoID == workOrderId); MRK_WorkOrder.MarketingInfoId = aMRK_WorkOrder.MarketingInfoId; MRK_WorkOrder.WorkOrderDate = aMRK_WorkOrder.WorkOrderDate; MRK_WorkOrder.CompletionPeriod = aMRK_WorkOrder.CompletionPeriod; MRK_WorkOrder.ProposedAmount = aMRK_WorkOrder.ProposedAmount; MRK_WorkOrder.SigningAmount = aMRK_WorkOrder.SigningAmount; MRK_WorkOrder.RemainingAmount = aMRK_WorkOrder.RemainingAmount; MRK_WorkOrder.Remarks = aMRK_WorkOrder.Remarks; MRK_WorkOrder.PaymentCondition = aMRK_WorkOrder.PaymentCondition; MRK_WorkOrder.AMC_Condition = aMRK_WorkOrder.AMC_Condition; MRK_WorkOrder.DevelopmentDept = aMRK_WorkOrder.DevelopmentDept; MRK_WorkOrder.WarrantyPeriod = aMRK_WorkOrder.WarrantyPeriod; MRK_WorkOrder.AMCDAte = aMRK_WorkOrder.AMCDAte; MRK_WorkOrder.HandoverStatus = aMRK_WorkOrder.HandoverStatus; MRK_WorkOrder.Edit_User = aMRK_WorkOrder.Edit_User; MRK_WorkOrder.Edit_Date = aMRK_WorkOrder.Edit_Date; MRK_WorkOrder.OCODE = aMRK_WorkOrder.OCODE; _Context.SaveChanges(); return(1); } catch (Exception) { throw; } }
internal int SaveWordOrderInfo(MRK_WorkOrder aMRK_WorkOrder) { using (_Context = new ERPSSL_Marketing_Entities()) { _Context.MRK_WorkOrder.AddObject(aMRK_WorkOrder); _Context.SaveChanges(); return(aMRK_WorkOrder.WoID); } }
protected void saveButton_Click(object sender, EventArgs e) { try { if (saveButton.Text == "Submit") { if (handoverStatusDropDownList.Text == "--Select--") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Handover Status')", true); } else if (warrentyPeriodTextBox.Text == null) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Input Warranty Period (Months)')", true); } else if (handoverStatusDropDownList.Text != "--Select--") { if (handoverStatusDropDownList.Text == "Yes") { handoverConditins = true; } else if (handoverStatusDropDownList.Text == "No") { handoverConditins = false; } MRK_WorkOrder aMRK_WorkOrder = new MRK_WorkOrder(); aMRK_WorkOrder.MarketingInfoId = Convert.ToInt32(HidMarketingInfoId.Value); aMRK_WorkOrder.WorkOrderDate = Convert.ToDateTime(workOrderDateTextBox.Text); aMRK_WorkOrder.CompletionPeriod = workCompletionPeriodTextBox.Text; aMRK_WorkOrder.ProposedAmount = Convert.ToDecimal(proposedAmountTextBox.Text); aMRK_WorkOrder.SigningAmount = Convert.ToDecimal(signingAmountTextBox.Text); aMRK_WorkOrder.RemainingAmount = Convert.ToDecimal(remainingAmountTextBox.Text); aMRK_WorkOrder.PaymentCondition = paymentConditionTextBox.Text; aMRK_WorkOrder.AMC_Condition = amcConditionTextBox.Text; aMRK_WorkOrder.DevelopmentDept = developmentDepartmentTextBox.Text; aMRK_WorkOrder.HandoverStatus = handoverConditins; aMRK_WorkOrder.Remarks = remarksTextBox.Text; aMRK_WorkOrder.WarrantyPeriod = Convert.ToInt32(warrentyPeriodTextBox.Text); aMRK_WorkOrder.AMCDAte = Convert.ToDateTime(amcDateTextBox.Text); aMRK_WorkOrder.Create_User = ((SessionUser)Session["SessionUser"]).UserId; aMRK_WorkOrder.Create_Date = DateTime.Now; aMRK_WorkOrder.OCODE = ((SessionUser)Session["SessionUser"]).OCode; int result = aWorkOrderDetailsBLL.SaveWorkOrderInfo(aMRK_WorkOrder); MRK_Transaction aMRK_Transaction = new MRK_Transaction(); aMRK_Transaction.WorkOrderId = result; aMRK_Transaction.CollectionDate = Convert.ToDateTime(workOrderDateTextBox.Text); aMRK_Transaction.CollectionAmount = Convert.ToDecimal(signingAmountTextBox.Text); aMRK_Transaction.Remarks = remarksTextBox.Text; aMRK_Transaction.Create_User = ((SessionUser)Session["SessionUser"]).UserId; aMRK_Transaction.Create_Date = DateTime.Now; aMRK_Transaction.OCODE = ((SessionUser)Session["SessionUser"]).OCode; int result2 = aWorkOrderDetailsBLL.SaveWorkOrderToTransaction(aMRK_Transaction); List <LC_InputType> inputTypeList = new List <LC_InputType>(); inputTypeList = aWorkOrderDetailsBLL.GetAllTask(); foreach (LC_InputType typeList in inputTypeList) { MRK_Task_Details aMRK_Task_Details = new MRK_Task_Details(); aMRK_Task_Details.WorkOrderId = (int)result; aMRK_Task_Details.Remarks = ""; aMRK_Task_Details.Comments = ""; aMRK_Task_Details.Date = DateTime.Now; aMRK_Task_Details.Task = typeList.Input_Name; aMRK_Task_Details.Create_User = ((SessionUser)Session["SessionUser"]).UserId; aMRK_Task_Details.Create_Date = DateTime.Now; aMRK_Task_Details.OCode = ((SessionUser)Session["SessionUser"]).OCode; _context.MRK_Task_Details.AddObject(aMRK_Task_Details); _context.SaveChanges(); } if (result2 == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Saved Successfully')", true); } } } else if (saveButton.Text == "Update") { if (handoverStatusDropDownList.Text == "--Select--") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Handover Status')", true); } else if (handoverStatusDropDownList.Text != "--Select--") { if (handoverStatusDropDownList.Text == "Yes") { handoverConditins = true; } else if (handoverStatusDropDownList.Text == "No") { handoverConditins = false; } MRK_WorkOrder aMRK_WorkOrder = new MRK_WorkOrder(); aMRK_WorkOrder.MarketingInfoId = Convert.ToInt32(HidMarketingInfoId.Value); aMRK_WorkOrder.WorkOrderDate = Convert.ToDateTime(workOrderDateTextBox.Text); aMRK_WorkOrder.CompletionPeriod = workCompletionPeriodTextBox.Text; aMRK_WorkOrder.ProposedAmount = Convert.ToDecimal(proposedAmountTextBox.Text); aMRK_WorkOrder.SigningAmount = Convert.ToDecimal(signingAmountTextBox.Text); aMRK_WorkOrder.RemainingAmount = Convert.ToDecimal(remainingAmountTextBox.Text); aMRK_WorkOrder.Remarks = remarksTextBox.Text; aMRK_WorkOrder.PaymentCondition = paymentConditionTextBox.Text; aMRK_WorkOrder.AMC_Condition = amcConditionTextBox.Text; aMRK_WorkOrder.DevelopmentDept = developmentDepartmentTextBox.Text; aMRK_WorkOrder.HandoverStatus = handoverConditins; aMRK_WorkOrder.WarrantyPeriod = Convert.ToInt32(warrentyPeriodTextBox.Text); aMRK_WorkOrder.AMCDAte = Convert.ToDateTime(amcDateTextBox.Text); aMRK_WorkOrder.Edit_User = ((SessionUser)Session["SessionUser"]).UserId; aMRK_WorkOrder.Edit_Date = DateTime.Now; aMRK_WorkOrder.OCODE = ((SessionUser)Session["SessionUser"]).OCode; int workOrderId = Convert.ToInt16(HiddenFieldWorkOrderId.Value); int result = aWorkOrderDetailsBLL.UpdateWorkOrderInfo(aMRK_WorkOrder, workOrderId); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true); } } } ClearAllControl(); GetWorkOrderDetailsForGridView(); } catch (Exception ex) { string EID = Convert.ToString(((SessionUser)Session["SessionUser"]).EID); //LogController<officeSetup>.SetLog(ex, EID); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } GetWorkOrderDetailsForGridView(); }
internal int UpdateWorkOrderInfo(MRK_WorkOrder aMRK_WorkOrder, int workOrderId) { return(aWorkOrderDetailsDAL.UpdateWorkOrderInfo(aMRK_WorkOrder, workOrderId)); }
internal int SaveWorkOrderInfo(MRK_WorkOrder aMRK_WorkOrder) { return(aWorkOrderDetailsDAL.SaveWordOrderInfo(aMRK_WorkOrder)); }