protected void GetReceiptHeadByIssueID() { iPartReceiptClient objService = new iPartReceiptClient(); try { PORtGRNHead ReceiptHead = new PORtGRNHead(); CustomProfile profile = CustomProfile.GetProfile(); ReceiptHead = objService.GetReceiptHeadByIssueID(Convert.ToInt64(Session["PORIssueID"].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 long SetIntoPartConsumptionHead(PORtConsumptionHead ConsumptionHead, string[] conn) { BISPL_CRMDBEntities db = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); if (ConsumptionHead.ConH_ID == 0) { db.PORtConsumptionHeads.AddObject(ConsumptionHead); } else { db.PORtConsumptionHeads.Attach(ConsumptionHead); db.ObjectStateManager.ChangeObjectState(ConsumptionHead, EntityState.Modified); } if (ConsumptionHead.StatusID == 9 && ConsumptionHead.ReferenceID != 0) { PORtGRNHead grnhead = new PORtGRNHead(); grnhead = db.PORtGRNHeads.Where(g => g.GRNH_ID == ConsumptionHead.ReferenceID).FirstOrDefault(); db.PORtGRNHeads.Detach(grnhead); grnhead.StatusID = 9; db.PORtGRNHeads.Attach(grnhead); db.ObjectStateManager.ChangeObjectState(grnhead, EntityState.Modified); } db.SaveChanges(); return(ConsumptionHead.ConH_ID); }
protected void EmailSendWhenMaterialReceived(long ReceiptID, string[] conn) { try { string MailSubject; string MailBody; int E_ID; BISPL_CRMDBEntities db = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); PORtGRNHead GRNHead1 = new PORtGRNHead(); GRNHead1 = db.PORtGRNHeads.Where(g => g.GRNH_ID == ReceiptID).FirstOrDefault(); POR_SP_GetIssueSummaryBySiteIDsOrUserIDOrRequestIDOrIssueIDs_Result IssueRec = new POR_SP_GetIssueSummaryBySiteIDsOrUserIDOrRequestIDOrIssueIDs_Result(); IssueRec = db.POR_SP_GetIssueSummaryBySiteIDsOrUserIDOrRequestIDOrIssueIDs(GRNHead1.SiteID.Value.ToString(), 0, 0, GRNHead1.ReferenceID.ToString()).FirstOrDefault(); POR_SP_GetReceiptSummaryBySiteIDsOrUserIDOrRequestID_Result ReceiptRec = new POR_SP_GetReceiptSummaryBySiteIDsOrUserIDOrRequestID_Result(); ReceiptRec = db.POR_SP_GetReceiptSummaryBySiteIDsOrUserIDOrRequestID(IssueRec.SiteID.ToString(), 0, IssueRec.PRH_ID).Where(r => r.GRNH_ID == GRNHead1.GRNH_ID).FirstOrDefault(); string partdetail = EMailGetReceiptPratDetail(GRNHead1.GRNH_ID, Convert.ToInt32(GRNHead1.SiteID), conn); /*Acknowledgement Email to Issuer [Project Lead]*/ MailSubject = "Acknowledgement of Material Receipt of " + ReceiptRec.SiteName + " & Receipt No. " + ReceiptRec.GRNH_ID.ToString() + " against Issue No. " + IssueRec.MINH_ID.ToString(); MailBody = " Hello, <br/><b> " + IssueRec.IssuedByUserName + " </b> <br/><br/>" + " This is an automatically generated message in reference to a Material issued for " + ReceiptRec.SiteName + " - ID " + ReceiptRec.GRNH_ID.ToString() + "." + " Material has been received at " + ReceiptRec.SiteName + ", received by " + IssueRec.RequestByUserName + "." + " <br/>" + " Issue & Receipt Details are provided below : "; MailBody = MailBody + "<br/><br/>" + EmailGetIssueDetail(IssueRec.MINH_ID, conn); MailBody = MailBody + EMailGetReceiptDetail(ReceiptRec); MailBody = MailBody + partdetail; SendMail(MailBody + MailGetFooter(), MailSubject, EmailGetEmailIDsByUserID(Convert.ToInt64(IssueRec.IssuedByUserID), conn)); // SaveInboxData(Convert.ToInt64(IssueRec.IssuedByUserID), IssueRec.SiteID, "Receipt", MailSubject, MailBody, Convert.ToInt64(IssueRec.StatusID), conn); /*End*/ /*Information mail to Operation Manger*/ string[] MailTo = new string[] { }; MailTo = EmailGetEmailIDsBySiteIDApprovalLevel(IssueRec.SiteID, 1, conn); string[] MailToName = MailTo[0].Split('|'); string[] MailToEmailID = MailTo[1].Split(','); for (int i = 0; i < MailToName.Count(); i++) { MailBody = " Hello, <br/><b> " + MailToName[i] + " </b> <br/><br/>" + " This is an automatically generated message in reference to a Material issued for " + ReceiptRec.SiteName + " - ID " + ReceiptRec.GRNH_ID.ToString() + "." + " Material has been received at " + ReceiptRec.SiteName + ", received by " + IssueRec.RequestByUserName + "." + " <br/>" + " Issue & Receipt Details are provided below : "; MailBody = MailBody + "<br/><br/>" + EmailGetIssueDetail(IssueRec.MINH_ID, conn); MailBody = MailBody + EMailGetReceiptDetail(ReceiptRec); MailBody = MailBody + partdetail; SendMail(MailBody + MailGetFooter(), MailSubject, MailToEmailID[i]); // E_ID = Convert.ToInt32(GetIDFromEmailName(MailTo[0], MailTo[1], conn)); // SaveInboxData(E_ID, IssueRec.SiteID, "Receipt", MailSubject, MailBody, Convert.ToInt64(IssueRec.StatusID), conn); } } catch { } finally { } }
public PORtGRNHead GetReceiptHeadByReceiptID(long ReceiptID, string[] conn) { BISPL_CRMDBEntities db = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); PORtGRNHead PartReceipt = new PORtGRNHead(); PartReceipt = db.PORtGRNHeads.Where(g => g.GRNH_ID == ReceiptID).FirstOrDefault(); db.PORtGRNHeads.Detach(PartReceipt); return(PartReceipt); }
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 PORtGRNHead GetReceiptHeadByIssueID(long IssueID, string[] conn) { BISPL_CRMDBEntities db = new BISPL_CRMDBEntities(svr.GetEntityConnection(conn)); List <PORtGRNHead> ReceiptHead = new List <PORtGRNHead>(); PORtGRNHead ReturnReceiptHead = new PORtGRNHead(); ReceiptHead = db.PORtGRNHeads.Where(g => g.ReferenceID == IssueID && g.ObjectName == "MaterialIssue").DefaultIfEmpty().ToList(); if (ReceiptHead.Count > 0) { if (ReceiptHead[0] != null) { db.PORtGRNHeads.Detach(ReceiptHead[0]); ReturnReceiptHead = ReceiptHead[0]; } } return(ReturnReceiptHead); }
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(); return(GRNHead.GRNH_ID); }
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 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(); } }