public static PORtMINHead WMSetSessionIssue(string InvokerObject, long IssueID, string state) { iPartIssueClient objService = new iPartIssueClient(); PORtMINHead IssueHead = new PORtMINHead(); try { CustomProfile profile = CustomProfile.GetProfile(); HttpContext.Current.Session["PORIssueID"] = IssueID; HttpContext.Current.Session["PORstate"] = state; objService.ClearTempDataFromDB(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr); objService.GetIssuePartDetailByIssueID(IssueID, HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, "true", profile.DBConnection._constr).ToList(); IssueHead = objService.GetIssueHeadByIssueID(IssueID, profile.DBConnection._constr); } catch { } finally { objService.Close(); } return(IssueHead); }
public long SetIntoGRNHead(PORtGRNHead GRNHead, string[] conn) { BISPL_CRMDBEntities db = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); if (GRNHead.GRNH_ID == 0) { db.PORtGRNHeads.AddObject(GRNHead); } else { db.PORtGRNHeads.Attach(GRNHead); db.ObjectStateManager.ChangeObjectState(GRNHead, EntityState.Modified); } db.SaveChanges(); if (GRNHead.StatusID > 1) { /*Update Issue Status*/ PORtMINHead MINHead = new PORtMINHead(); MINHead = db.PORtMINHeads.Where(r => r.MINH_ID == GRNHead.ReferenceID).FirstOrDefault(); db.PORtMINHeads.Detach(MINHead); MINHead.StatusID = GRNHead.StatusID; db.PORtMINHeads.Attach(MINHead); db.ObjectStateManager.ChangeObjectState(MINHead, EntityState.Modified); db.SaveChanges(); /*Update Request Status*/ PORtPartRequestHead RequestHead = new PORtPartRequestHead(); RequestHead = db.PORtPartRequestHeads.Where(r => r.PRH_ID == MINHead.PRH_ID).FirstOrDefault(); db.PORtPartRequestHeads.Detach(RequestHead); RequestHead.StatusID = GRNHead.StatusID; db.PORtPartRequestHeads.Attach(RequestHead); db.ObjectStateManager.ChangeObjectState(RequestHead, EntityState.Modified); db.SaveChanges(); /*End*/ } return(GRNHead.GRNH_ID); }
public static string WMSaveIssueHead(object objIssue) { string result = ""; iPartIssueClient objService = new iPartIssueClient(); try { CustomProfile profile = CustomProfile.GetProfile(); PORtMINHead IssueHead = new PORtMINHead(); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)objIssue; if (HttpContext.Current.Session["PORIssueID"] != null) { if (HttpContext.Current.Session["PORIssueID"].ToString() == "0") { IssueHead.CreatedBy = profile.Personal.UserID; IssueHead.CreationDt = DateTime.Now; } else { IssueHead = objService.GetIssueHeadByIssueID(Convert.ToInt64(HttpContext.Current.Session["PORIssueID"]), profile.DBConnection._constr); IssueHead.LastModifiedBy = profile.Personal.UserID; IssueHead.LastModifiedDt = DateTime.Now; } IssueHead.SiteID = Convert.ToInt64(dictionary["SiteID"]); IssueHead.PRH_ID = Convert.ToInt64(HttpContext.Current.Session["PORRequestID"].ToString()); IssueHead.MIN_No = "N/A"; IssueHead.IssueDate = Convert.ToDateTime(dictionary["IssueDate"]); IssueHead.IssuedByUserID = Convert.ToInt64(dictionary["IssuedByUserID"]); IssueHead.StatusID = Convert.ToInt64(dictionary["StatusID"]); IssueHead.AirwayBill = dictionary["AirwayBill"].ToString(); IssueHead.ShippingType = dictionary["ShippingType"].ToString(); if (dictionary["ShippingDate"].ToString() != "") { IssueHead.ShippingDate = Convert.ToDateTime(dictionary["ShippingDate"].ToString()); } if (dictionary["ExpectedDelDate"].ToString() != "") { IssueHead.ExpectedDelDate = Convert.ToDateTime(dictionary["ExpectedDelDate"].ToString()); } IssueHead.TransporterName = dictionary["TransporterName"].ToString(); IssueHead.Remark = dictionary["Remark"].ToString(); IssueHead.IsSubmit = Convert.ToBoolean(dictionary["IsSubmit"]); if (IssueHead.StatusID != 1 && IssueHead.StatusID != 10) { IssueHead.StatusID = objService.GetStatusOfIssueHead(HttpContext.Current.Session.SessionID.ToString(), profile.Personal.UserID.ToString(), ObjectName, Convert.ToInt64(IssueHead.PRH_ID), profile.DBConnection._constr); } long IssueID = objService.SetIntoMINHead(IssueHead, profile.DBConnection._constr); if (IssueID > 0) { string IssueStatus = "NA"; if (IssueHead.StatusID != 1 && IssueHead.StatusID != 10) { IssueStatus = "Issue"; } objService.FinalSaveIssuePartDetail(HttpContext.Current.Session.SessionID, ObjectName, IssueID, Convert.ToInt64(IssueHead.PRH_ID), profile.Personal.UserID.ToString(), IssueStatus, profile.DBConnection._constr); result = "Material Issue record saved successfully"; } } } catch { result = "Some error occurred"; } finally { objService.Close(); } return(result); }
protected void GetIssueHead() { iPartIssueClient objServiceIssue = new iPartIssueClient(); iPartRequestClient objServiceRequest = new iPartRequestClient(); try { CustomProfile profile = CustomProfile.GetProfile(); PORtMINHead IssueHead = new PORtMINHead(); IssueHead = objServiceIssue.GetIssueHeadByIssueID(Convert.ToInt64(HttpContext.Current.Session["PORIssueID"]), profile.DBConnection._constr); ddlStatus.DataSource = WMFillStatus(); ddlStatus.DataBind(); ddlStatus.SelectedIndex = ddlStatus.Items.IndexOf(ddlStatus.Items.FindByValue(IssueHead.StatusID.ToString())); lblIssueNo.Text = IssueHead.MINH_ID.ToString(); UC_IssueDate.Date = DateTime.Now; if (IssueHead.IssueDate != null) { UC_IssueDate.Date = IssueHead.IssueDate; } FillUserList(1); ddlIssuedBy.SelectedIndex = ddlIssuedBy.Items.IndexOf(ddlIssuedBy.Items.FindByValue(IssueHead.IssuedByUserID.ToString())); if (ddlIssuedBy.SelectedIndex == 0) { ddlIssuedBy.SelectedIndex = ddlIssuedBy.Items.IndexOf(ddlIssuedBy.Items.FindByValue(profile.Personal.UserID.ToString())); } /*Transport detail*/ if (IssueHead.AirwayBill != null) { txtAirwayBill.Text = IssueHead.AirwayBill; } if (IssueHead.ShippingType != null) { txtShippingType.Text = IssueHead.ShippingType; } UC_ShippingDate.Date = DateTime.Now; if (IssueHead.ShippingDate != null) { UC_ShippingDate.Date = IssueHead.ShippingDate; } UC_ExpDeliveryDate.Date = DateTime.Now; if (IssueHead.ExpectedDelDate != null) { UC_ExpDeliveryDate.Date = IssueHead.ExpectedDelDate; } if (IssueHead.TransporterName != null) { txtTransporterName.Text = IssueHead.TransporterName; } if (IssueHead.Remark != null) { txtIssueRemark.Text = IssueHead.Remark; } FillGrid1ByIssueID(IssueHead.MINH_ID); Session["PORRequestID"] = IssueHead.PRH_ID.ToString(); DisplayRequestData(); // iframePORIssue.Attributes.Add("src", "../PowerOnRent/GridIssueSummary.aspx?FillBy=RequestID"); divDisabled(); } catch { } finally { objServiceIssue.Close(); } }
public void GetDefaultConsumptionfromRequestHead() { iPartRequestClient objRequestService = new iPartRequestClient(); iPartIssueClient objIssueService = new iPartIssueClient(); iPartReceiptClient objReceiptService = new iPartReceiptClient(); iPartConsumptionClient objConsumptionService = new iPartConsumptionClient(); try { HttpContext.Current.Session["PORConsumptionID"] = "0"; CustomProfile profile = CustomProfile.GetProfile(); if (Session["PORReceiptID"] != null) { if (Session["PORReceiptID"].ToString() != "0") { PORtGRNHead ReceiptHead = new PORtGRNHead(); PORtMINHead IssueHead = new PORtMINHead(); PORtPartRequestHead RequestHead = new PORtPartRequestHead(); ReceiptHead = objReceiptService.GetReceiptHeadByReceiptID(Convert.ToInt64(Session["PORReceiptID"].ToString()), profile.DBConnection._constr); if (ReceiptHead != null) { IssueHead = objIssueService.GetIssueHeadByIssueID(Convert.ToInt64(ReceiptHead.ReferenceID), profile.DBConnection._constr); } if (IssueHead != null) { RequestHead = objRequestService.GetRequestHeadByRequestID(Convert.ToInt64(IssueHead.PRH_ID), profile.DBConnection._constr); } if (RequestHead != null) { ddlSites.SelectedIndex = ddlSites.Items.IndexOf(ddlSites.Items.FindByValue(RequestHead.SiteID.ToString())); UC_DateConsumption.Date = DateTime.Now; ddlStatus.SelectedIndex = 1; ddlConsumedBy.DataSource = null; ddlConsumedBy.DataBind(); ddlConsumedBy.DataSource = WMFillUserList(Convert.ToInt64(RequestHead.SiteID)); ddlConsumedBy.DataBind(); ddlConsumedBy.SelectedIndex = ddlConsumedBy.Items.IndexOf(ddlConsumedBy.Items.FindByValue(profile.Personal.UserID.ToString())); ddlContainer.DataSource = null; ddlContainer.DataBind(); ddlContainer.DataSource = WMFillEnginList(Convert.ToInt64(RequestHead.SiteID)); ddlContainer.DataBind(); ddlContainer.SelectedIndex = ddlContainer.Items.IndexOf(ddlContainer.Items.FindByText(RequestHead.Container.ToString())); lblEngineModel.Text = RequestHead.EngineModel.ToString(); lblEngineSerial.Text = RequestHead.EngineSerial.ToString(); txtFailureHours.Text = RequestHead.FailureHours.ToString(); txtFailureCause.Text = RequestHead.FailureCause.ToString(); txtFailureNature.Text = RequestHead.FailureNature.ToString(); FillPartDetailByReceiptID(Convert.ToInt64(Session["PORReceiptID"].ToString())); } } } } catch { } finally { objRequestService.Close(); objIssueService.Close(); objReceiptService.Close(); } }