protected void GetReceiptHeadByReceiptID() { iPartReceiptClient objService = new iPartReceiptClient(); try { PORtGRNHead ReceiptHead = new PORtGRNHead(); CustomProfile profile = CustomProfile.GetProfile(); ReceiptHead = objService.GetReceiptHeadByReceiptID(Convert.ToInt64(Session["PORReceiptID"].ToString()), profile.DBConnection._constr); if (ReceiptHead != null) { Session["PORIssueID"] = ReceiptHead.ReferenceID.Value.ToString(); GetRequest_n_IssueHeadByIssueID(); hdnReceiptID.Value = ReceiptHead.GRNH_ID.ToString(); lblReceiptNo.Text = ReceiptHead.GRNH_ID.ToString(); UC_ReceiptDate.Date = DateTime.Now; if (ReceiptHead.GRN_Date != null) { UC_ReceiptDate.Date = ReceiptHead.GRN_Date; } ddlStatus.SelectedIndex = ddlStatus.Items.IndexOf(ddlStatus.Items.FindByValue(ReceiptHead.StatusID.Value.ToString())); if (ReceiptHead.ReceivedByUserID != 0) { ddlReceivedBy.SelectedIndex = ddlReceivedBy.Items.IndexOf(ddlReceivedBy.Items.FindByValue(ReceiptHead.ReceivedByUserID.Value.ToString())); } txtReceiptRemark.Text = ReceiptHead.Remark; GridReceipt.DataSource = objService.GetReceiptPartDetailByReceiptID(ReceiptHead.GRNH_ID, Convert.ToInt64(hdnSiteID.Value), Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, "true", profile.DBConnection._constr); GridReceipt.DataBind(); divDisabled(); } } catch { } finally { objService.Close(); } }
public static string WMSaveReceiptHead(object objReceipt) { HttpContext.Current.Session.Remove("PORIssueID"); string result = ""; iPartReceiptClient objService = new iPartReceiptClient(); try { CustomProfile profile = CustomProfile.GetProfile(); PORtGRNHead ReceiptHead = new PORtGRNHead(); Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = (Dictionary <string, object>)objReceipt; if (HttpContext.Current.Session["PORReceiptID"] != null) { if (HttpContext.Current.Session["PORReceiptID"] == "0") { ReceiptHead.CreatedBy = profile.Personal.UserID; ReceiptHead.CreationDt = DateTime.Now; } else { ReceiptHead = objService.GetReceiptHeadByReceiptID(Convert.ToInt64(HttpContext.Current.Session["PORReceiptID"]), profile.DBConnection._constr); ReceiptHead.LastModifiedBy = profile.Personal.UserID; ReceiptHead.LastModifiedDt = DateTime.Now; } ReceiptHead.SiteID = Convert.ToInt64(dictionary["SiteID"]); ReceiptHead.ObjectName = dictionary["ObjectName"].ToString(); ReceiptHead.ReferenceID = Convert.ToInt64(dictionary["ReferenceID"].ToString()); ReceiptHead.GRN_No = "N/A"; ReceiptHead.GRN_Date = Convert.ToDateTime(dictionary["GRN_Date"].ToString()); ReceiptHead.ReceivedByUserID = Convert.ToInt64(dictionary["ReceivedByUserID"]); ReceiptHead.StatusID = Convert.ToInt64(dictionary["StatusID"]); ReceiptHead.Remark = dictionary["Remark"].ToString(); ReceiptHead.IsSubmit = Convert.ToBoolean(dictionary["IsSubmit"]); long ReceiptID = objService.SetIntoGRNHead(ReceiptHead, profile.DBConnection._constr); string status = ""; if (ReceiptHead.StatusID == 8) { status = "Received"; } if (ReceiptID > 0) { objService.FinalSaveReceiptPartDetail(HttpContext.Current.Session.SessionID, ObjectName, ReceiptID, profile.Personal.UserID.ToString(), status, profile.DBConnection._constr); result = "Material Receipt record saved successfully"; } } } catch { result = "Some error occurred"; } finally { objService.Close(); } return(result); }
public static PORtGRNHead WMGetReceiptHead() { iPartReceiptClient objService = new iPartReceiptClient(); PORtGRNHead ReceiptHead = new PORtGRNHead(); try { CustomProfile profile = CustomProfile.GetProfile(); objService.ClearTempDataFromDB(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr); ReceiptHead = objService.GetReceiptHeadByReceiptID(Convert.ToInt64(HttpContext.Current.Session["PORReceiptID"].ToString()), profile.DBConnection._constr); } catch { } finally { objService.Close(); } return(ReceiptHead); }
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(); } }