/// <summary> /// Bind Page details /// </summary> public void BindDeatils() { try { DataSet ds = BLL_PURC_Common.PURC_Get_RequisitionDeatils(UDFLib.ConvertToInteger(GetSessionUserID()), GetDocumentCode()); if (ds.Tables[0].Rows.Count > 0) { ViewState["flt_DocumentCode"] = GetDocumentCode(); ViewState["flt_ReqsnCode"] = ds.Tables[0].Rows[0]["REQUISITION_CODE"].ToString(); lblfleet.Text = ds.Tables[0].Rows[0]["FleetName"].ToString(); //lblAccType.Text = ds.Tables[0].Rows[0]["Account_Name"].ToString(); lblDepartmentName.Text = ds.Tables[0].Rows[0]["DEPARTMENT"].ToString(); lblRequisitionType.Text = ds.Tables[0].Rows[0]["Reqn_Name"].ToString(); lblCatalouge.Text = ds.Tables[0].Rows[0]["System_Description"].ToString(); lblVessel.Text = ds.Tables[0].Rows[0]["Vessel_Name"].ToString(); lblUrgency.Text = ds.Tables[0].Rows[0]["URGENCY_Type"].ToString(); hdnVesselID.Value = ds.Tables[0].Rows[0]["Vessel_Code"].ToString(); hdnPOType.Value = ds.Tables[0].Rows[0]["PO_Type"].ToString(); BindSubCatalogue(ds.Tables[0].Rows[0]["Requested_Catalouge"].ToString()); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void BindItems() { int IsFetch_Count = ucCustomPagerItems.isCountRecord; DataTable dtItems = BLL_PURC_Common.Get_Inventory_Item_List(Convert.ToInt32(DDLFleet.SelectedValue), Convert.ToInt32(DDLVessel.SelectedValue), cmbDept.SelectedValue, ddlCatalogue.SelectedValue, ddlSubCatalogue.SelectedValue, txtSrchPartNo.Text.Trim() == "" ? "0" : txtSrchPartNo.Text.Trim(), txtDrawno.Text.Trim() == "" ? "0" : txtDrawno.Text.Trim(), txtSrchDesc.Text.Trim() == "" ? "0" : txtSrchDesc.Text.Trim(), txtFrom.Text.Trim() == "" ? "1900/01/01" : txtFrom.Text.Trim(), txtTo.Text.Trim() == "" ? "2099/01/01" : txtTo.Text.Trim(), rbtnRob.Checked == true ? 1 : 0, rbtnLatest.Checked == true ? 1 : 0, chkInventory_Qty_Less.Checked == true?1:0, chkInventory_Qty_Greater.Checked == true?1:0, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, chkCritcal.Checked == true ? 1 : 0, ref IsFetch_Count ); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = IsFetch_Count.ToString(); ucCustomPagerItems.BuildPager(); } gvInventoryItems.DataSource = dtItems; gvInventoryItems.DataBind(); }
protected void onSelect(object source, CommandEventArgs e) { HiddenArgument.Value = e.CommandArgument.ToString(); string[] strArgs = HiddenArgument.Value.Split('&'); string sOnHold = strArgs[4]; if (sOnHold.ToString() == "False") { BLL_PURC_Common objComm = new BLL_PURC_Common(); string CompanyID = Session["USERCOMPANYID"].ToString(); DataTable dt = objComm.Get_LIB_Page_Config(UDFLib.ConvertToInteger(CompanyID), PageKeyValue); if (dt.Rows.Count > 0) { ResponseHelper.Redirect("QuatationEvalutionDetails.aspx?Requisitioncode=" + e.CommandArgument.ToString(), "blank", ""); } else { ResponseHelper.Redirect("QuatationEvalution.aspx?Requisitioncode=" + e.CommandArgument.ToString(), "blank", ""); } } else { String msg = String.Format("alert('This requisition has been marked as OnHold.'); window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); } }
protected void btndivReqprioOK_Click(object sender, EventArgs e) { int iReturn = 0; if (ucPurc_Rollback_Reqsn1.Reason != "") { string[] strArgs = HiddenArgument.Value.Split(','); string sRequisitionCode = strArgs[0]; string sDocumentCode = strArgs[1]; string sVessel_Code = strArgs[2]; string sLinkType = sRequiPendingType; string sOnHold = strArgs[4]; string QuotationCode = strArgs[5]; string sReason = ucPurc_Rollback_Reqsn1.Reason; string sCanceledOnStage = ""; string sRemarks = ucPurc_Rollback_Reqsn1.Reason; sCanceledOnStage = ucPurc_Rollback_Reqsn1.StageValue; string sReqCode = (string)Session["REQNUM"]; string sDeptType = (string)Session["sDeptType"]; try { using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase()) { iReturn = objTechService.CancelRequisitionStages(Convert.ToInt32(sVessel_Code), sRequisitionCode, sDocumentCode, sCanceledOnStage, sReason, Convert.ToInt32(Session["userid"].ToString()), Request.QueryString["type"].ToString(), QuotationCode); if (iReturn > 0) { BLL_PURC_Common.INS_Remarks(sDocumentCode, Convert.ToInt32(Session["userid"].ToString()), sReason, 305); divOnHold.Visible = false; String msg = String.Format("alert('Requisition has been shifted on " + ucPurc_Rollback_Reqsn1.StageText + "');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); BindRequisitionGrid(); } else if (iReturn == -10001) { String msg = String.Format("alert('action can not be completed because invoice has been uploaded');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); } divReqStages.Visible = false; } } catch (Exception ex) { //.WriteError(this.GetType().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), ex); } } else { String msg = String.Format("alert('Reason is mandatory field.');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); } }
protected void btnSaveFinalize_Click(object s, EventArgs e) { //if (Validate_Ordered_Quantity()) //{ DataTable dtVslToFinalize = Save_Orders(); int sts = BLL_PURC_Common.UPD_Reqsn_Split_IntoVessel_Finalize(Request.QueryString["ReqsnCode"], dtVslToFinalize, UDFLib.ConvertToInteger(Session["userid"].ToString())); if (sts > 0) { lblmsg.Text = "Finalized successfully."; String msgApp = String.Format("alert('Finalized successfully.');RefreshPendingDetails();window.open('','_self');window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg99011a", msgApp, true); } else { lblmsg.Text = "Unable to finalize !"; BindSplittedItems(); } //} //else //{ // lblmsg.Text = "splited order qty can not be grater than actual order qty !"; //} }
private void BindItems() { try { if (Convert.ToInt32(ViewState["IsApproved"].ToString()) != 0) { dtGridItems = BLL_PURC_Common.Get_ReqsnItemToApprove(Request.QueryString["ReqCode"].ToString()); rgdItems.DataSource = dtGridItems; rgdItems.DataBind(); rgdItems.ShowFooter = false; } else { dtGridItems = GetAddTable(); rgdItems.DataSource = GetAddTable(); rgdItems.DataBind(); } ViewState["dtGridItems"] = dtGridItems; } catch (Exception ex) { lblError.Text = ex.ToString(); //.WriteError(this.GetType().Name.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name.ToString(), ex); } finally { } }
protected void BindData() { int rowcount = ucCustomPagerItems.isCountRecord; int?Finalized = null; if (ucCustomDropDownListstatus.SelectedValues.Rows.Count == 1) { Finalized = Convert.ToInt32(ucCustomDropDownListstatus.SelectedValues.Rows[0][0]); } DataTable dt = BLL_PURC_Common.Get_Bulk_Purchase_Reqsn((DataTable)Session["sFleet"], (DataTable)Session["sVesselCode"] , UDFLib.ConvertStringToNull(Session["sDeptType"]), (DataTable)Session["sDeptCode"] , UDFLib.ConvertIntegerToNull(Session["ReqsnType"].ToString()), UDFLib.ConvertStringToNull(Session["REQNUM"].ToString()), Finalized , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } gvBulkPurchase.DataSource = dt; gvBulkPurchase.DataBind(); if (ucCustomDropDownListstatus.SelectedValues.Rows.Count > 0) { (gvBulkPurchase.HeaderRow.FindControl("imgStatusFilter") as Image).ImageUrl = "../Images/filter-add-icon-green.png"; } string script = " var height = document.body.scrollHeight;parent.ResizeFromChild(height,'1');"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "resize" + DateTime.Now.Millisecond.ToString(), script, true); }
protected void lbtnQtnRcvd_Click(object s, EventArgs e) { string[] strArgs = ((LinkButton)s).CommandArgument.Split('&'); string sOnHold = strArgs[4]; if (sOnHold.ToString() != "False") { String msg = String.Format("alert('This requisition has been marked as OnHold.');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); } else if (sOnHold.ToString() == "False" && UDFLib.ConvertToInteger(((LinkButton)s).Text.Trim()) > 0) { BLL_PURC_Common objComm = new BLL_PURC_Common(); string CompanyID = Session["USERCOMPANYID"].ToString(); DataTable dt = objComm.Get_LIB_Page_Config(UDFLib.ConvertToInteger(CompanyID), PageKeyValue); if (dt.Rows.Count > 0) { ResponseHelper.Redirect("QuatationEvalutionDetails.aspx?Requisitioncode=" + ((LinkButton)s).CommandArgument, "blank", ""); } else { ResponseHelper.Redirect("QuatationEvalution.aspx?Requisitioncode=" + ((LinkButton)s).CommandArgument, "blank", ""); } } }
protected void btnActivatePO_Click(object s, EventArgs e) { int Active_PO_Count = BLL_PURC_Common.Get_Active_PO_Count(((Button)s).CommandArgument); if (Active_PO_Count == 0) { int sts = BLL_PURC_Common.Activate_Cancelled_PO_DL(((Button)s).CommandArgument, Convert.ToInt32(Session["userid"].ToString())); if (sts > 0) { String msg = String.Format("alert('This requisition has been re-activated successfully.');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgactivatedPO", msg, true); ucCustomPagerItems.isCountRecord = 1; BindData(); } else { String msg = String.Format("alert('Fail to activate this PO.');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgactivatedReqsn", msg, true); ucCustomPagerItems.isCountRecord = 1; BindData(); } } else { String msg = String.Format("alert('Active PO already exists for this Supplier.');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgactiveReqsn", msg, true); ucCustomPagerItems.isCountRecord = 1; BindData(); } }
protected void BindData() { try { DataSet ds = BLL_PURC_Common.PURC_Get_RequisitionDeatils(UDFLib.ConvertToInteger(GetSessionUserID()), GetDocumentCode()); if (ds.Tables[0].Rows.Count > 0) { lblAccClassification.Text = ds.Tables[0].Rows[0]["Account_Classification"].ToString(); lblSubCatalogue.Text = Session["SUBCATALOGUENAME"].ToString(); lblCatalogue.Text = ds.Tables[0].Rows[0]["System_Description"].ToString(); ViewState["VesselID"] = ds.Tables[0].Rows[0]["Vessel_Code"].ToString(); ViewState["Reqsn_Type"] = ds.Tables[0].Rows[0]["Reqsn_Type"].ToString(); if (ds.Tables[0].Rows[0]["Reqsn_Type"].ToString() == "SP") { trCritical.Visible = true; } else if (ds.Tables[0].Rows[0]["Reqsn_Type"].ToString() == "RP") { trCritical.Visible = true; } else { trCritical.Visible = false; } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } finally { } }
private void Bind_Grading() { DataTable dt = BLL_PURC_Common.Get_GradingList(); grdGrading.DataSource = dt; grdGrading.DataBind(); }
protected void btnSave_Click(object s, EventArgs e) { foreach (GridViewRow gr in gvSupplier.Rows) { int Isassigned = ((CheckBox)gr.FindControl("chkIsSent")).Checked == true ? 1 : 0; BLL_PURC_Common.Update_AssignedAttachFile(lblReqsn.Text.Trim(), lblFineName.Text.Trim(), ((Label)gr.FindControl("lblSuppcode")).Text, Isassigned, UDFLib.ConvertToInteger(Session["USERID"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { dlistPONumber.DataSource = BLL_PURC_Common.Get_PONumbers(ReqsnNumber); dlistPONumber.DataBind(); } }
protected void btndivReqprioOK_Click(object sender, EventArgs e) { if (ucPurc_Rollback_Reqsn1.Reason != "") { string[] strArgs = HiddenArgument.Value.Split(','); string sRequisitionCode = strArgs[0]; string sDocumentCode = strArgs[1]; string sVessel_Code = strArgs[2]; string sLinkType = sRequiPendingType; string sOnHold = strArgs[4]; string sQuotationCode = strArgs[5]; string sReason = ucPurc_Rollback_Reqsn1.Reason; string sCanceledOnStage = ""; string sRemarks = ucPurc_Rollback_Reqsn1.Reason; sCanceledOnStage = ucPurc_Rollback_Reqsn1.StageValue; try { using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase()) { int iReturn = objTechService.CancelRequisitionStages(Convert.ToInt32(sVessel_Code), sRequisitionCode, sDocumentCode, sCanceledOnStage, sReason, Convert.ToInt32(Session["userid"].ToString()), Request.QueryString["type"].ToString(), sQuotationCode); if (iReturn > 0) { BLL_PURC_Common.INS_Remarks(sDocumentCode, Convert.ToInt32(Session["userid"].ToString()), sReason, 305); divOnHold.Visible = false; String msg = String.Format("alert('Requisition has been shifted on " + ucPurc_Rollback_Reqsn1.StageText + "'); "); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); ucCustomPagerItems.isCountRecord = 1; BindData(); #region To Generate Cancel PO if (sCanceledOnStage == "QEV" || sCanceledOnStage == "RFQ") { String funname = "GeneratePDf();"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "funname", funname, true); } #endregion } else if (iReturn == -10001) { String msg = String.Format("alert('action can not be completed because invoice has been uploaded');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); } } divReqStages.Visible = false; } catch (Exception ex) { String msg = String.Format("alert('" + ex.Message + "')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); } } else { String msg = String.Format("alert('Reason is mandatory field.'); "); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); } }
protected void Page_Load(object sender, EventArgs e) { gvItemsSplit.DataSource = BLL_PURC_Common.Get_ReqsnItems_Split_ToVessel_Report(Request.QueryString["ReqsnCode"]); gvItemsSplit.DataBind(); BindRequisitionInfo(); String msgretv = String.Format("setTimeout(calculatePriceAndQty_Onload,1000);"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgonFinal", msgretv, true); }
protected void BindSuppliersList() { chklstSuppliers.ClearSelection(); chklstSuppliers.DataSource = BLL_PURC_Common.Get_SupplierList(null, null); chklstSuppliers.DataTextField = "fullname"; chklstSuppliers.DataValueField = "SUPPLIER"; chklstSuppliers.DataBind(); // chklstSuppliers.Items.Insert(0, new ListItem("- ALL -", "0")); }
protected void grdQuestion_RowDeleting(object sender, GridViewDeleteEventArgs e) { int ID = UDFLib.ConvertToInteger(grdQuestion.DataKeys[e.RowIndex].Value.ToString()); string Mode = "D"; BLL_PURC_Common.INS_UPD_DEL_Question(ID, "", null, null, Convert.ToInt32(Session["USERID"]), Mode); Bind_Question(); Bind_Grading(); }
private void Bind_Question() { string searchtext = txtfilter.Text.Trim(); string department = ((ddlCategory.SelectedValue == "-Select-" || ddlCategory.SelectedValue == "0") ? "" : ddlCategory.SelectedValue); DataTable dtQuest = BLL_PURC_Common.Get_QuestionList(searchtext, department); grdQuestion.DataSource = dtQuest; grdQuestion.DataBind(); }
protected void btnApprove_Click(object sender, EventArgs e) { BLL_PURC_Purchase objApproval = new BLL_PURC_Purchase(); BLL_PURC_LOG.Ins_Log_Remark(Convert.ToInt32(Request.QueryString["LOG_ID"].ToString()), txtApproverRemark.Text, Convert.ToInt32(Session["USERID"]), 2); btnApprove.Enabled = false; SaveLPODetails(); DataTable dtSuppDate = BLL_PURC_Common.Get_Supplier_ValidDate("'" + uc_SupplierList1.SelectedValue + "'"); if (dtSuppDate.Rows.Count > 0) { if (Convert.ToDateTime(dtSuppDate.Rows[0]["ASL_Status_Valid_till"]) < DateTime.Now) { String msg = String.Format("alert('Selected Supplier has been expired/blacklisted');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg451", msg, true); } else { decimal TotalAmountToApproved = UDFLib.ConvertToDecimal(hdf_TotalAmount_USD.Value); ViewState["TotalAmountToApproved"] = TotalAmountToApproved; /*Below code is commented due to this JIT_8823 as below method checks for department as it doesnt required for Logistic Po.*/ //DataTable dtApproval = objApproval.Get_Approval_Limit(Convert.ToInt32(Session["USERID"]), ViewState["Dept_Code"].ToString()); decimal Applimit = BLL_PURC_LOG.Get_Log_Logistic_Approval_Limit(Convert.ToInt32(Session["USERID"])); //decimal Applimit = decimal.Parse(dtApproval.Rows[0]["Approval_Limit"].ToString()); if (Applimit < 1) { string msgmodal = String.Format("alert('Approval limit not found !')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Apprmodal", msgmodal, true); } else if (Applimit >= TotalAmountToApproved) { BLL_PURC_LOG.Ins_Log_Logistic_Approval_Entry(Convert.ToInt32(Session["USERID"].ToString()), Convert.ToInt32(Session["USERID"].ToString()), TotalAmountToApproved, Convert.ToInt32(Request.QueryString["LOG_ID"].ToString()), "", txtApproverRemark.Text, 1); string msgmodal = String.Format("alert('Approved successfully');parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Apprmodala", msgmodal, true); } else { ViewState["islimit<Total"] = 1; string msgmodal = String.Format("showModal('divSendForApproval');alert('The total PO amount is beyond your approval limit.Please forward to one of the following for approval')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Apprmodal", msgmodal, true); } } } }
protected void btnCloseRequisition_Click(object s, EventArgs e) { BindDataOnPostback(); BLL_PURC_Common.Upd_Close_Requisition(Request.QueryString["REQUISITION_CODE"].ToString(), Convert.ToInt32(Session["userid"])); String msg = String.Format("alert('Requisition has been closed.');RefreshPendingDetails();window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); }
protected void gvReqsnType_RowUpdating(object sender, GridViewUpdateEventArgs e) { BLL_PURC_Common.Upd_Reqsn_Type_Budget("", Convert.ToInt32((gvReqsnType.Rows[e.RowIndex].FindControl("ddlBudgetCode") as DropDownList).SelectedValue), Convert.ToInt32(gvReqsnType.DataKeys[e.RowIndex].Values["Reqsn_Type_Code"]), UDFLib.ConvertIntegerToNull(gvReqsnType.DataKeys[e.RowIndex].Values["ID"]), Convert.ToInt32(Session["userid"])); gvReqsnType.EditIndex = -1; BindItems(); }
protected void btnSearchSupplier_Click(object sender, EventArgs e) { pnlSearch.Visible = true; DataTable dt = BLL_PURC_Common.Get_SupplierList(Supplier_Category, null); lstSupplierList.DataSource = dt; lstSupplierList.DataBind(); lstSupplierList.Items.Insert(0, new ListItem("-Select-", "0")); }
protected void txtSearchSupplierList_TextChanged(object sender, EventArgs e) { string SearchText = txtSearchSupplierList.Text; DataTable dt = BLL_PURC_Common.Get_SupplierList(Supplier_Category, SearchText); lstSupplierList.DataSource = dt; lstSupplierList.DataBind(); lstSupplierList.Items.Insert(0, new ListItem("-Select-", "0")); }
protected void btnSaveAndAdd_Click(object sender, EventArgs e) { int ID = BLL_PURC_Common.INS_UPD_DEL_Question(null, txtQuestion.Text.Trim(), Convert.ToInt32(ddlGradingType.SelectedValue), UDFLib.ConvertIntegerToNull(ddlCatName.SelectedValue), Convert.ToInt32(Session["USERID"]), "A"); txtQuestion.Text = ""; Bind_Question(); Bind_Grading(); ClearControls_Question(); }
public string async_GetReqsn_Remarks(string DocumentCode, int RemarkType) { return(UDFLib.CreateHtmlTableFromDataTable(BLL_PURC_Common.GET_Remarks(DocumentCode, RemarkType), new string[] { "Name", "Type", "Date", "Remark" }, new string[] { "name", "Stage", "dateCr", "Remark" }, new string[] { "left", "left", "left", "left" }, null)); }
protected void imgbtnAssignedToSupp_Click(object s, EventArgs e) { GridViewRow item = (GridViewRow)((ImageButton)s).Parent.Parent; lblFineName.Text = ((ImageButton)s).CommandArgument.Trim(); gvSupplier.DataSource = BLL_PURC_Common.Get_AssignedAttach(Request.QueryString["REQUISITION_CODE"].ToString(), ((ImageButton)s).CommandArgument.Trim()); gvSupplier.DataBind(); ScriptManager.RegisterStartupScript(this, typeof(Page), "SuppAttachments", "showModal('dvAssignAttachment')", true); }
private void Get_Grading_ForQuestions() { DataTable dtGrad = BLL_PURC_Common.Get_GradingList(); ddlGradingType.DataSource = dtGrad; ddlGradingType.DataTextField = Convert.ToString(dtGrad.Columns["Grade_Name"]); ddlGradingType.DataValueField = Convert.ToString(dtGrad.Columns["ID"]); ddlGradingType.DataBind(); ddlGradingType.Items.Insert(0, new ListItem("-Select-", "0")); }
protected void gvItemHistory_RowDataBound(object sender, GridViewRowEventArgs e) { if (DataControlRowType.DataRow == e.Row.RowType) { DataList rptr = (DataList)e.Row.FindControl("rptQuoted"); string Document = ((Label)e.Row.FindControl("lblReqsnNO")).ToolTip; rptr.DataSource = BLL_PURC_Common.Get_QuotedRates_ByItem(Document, Request.QueryString["item_ref_code"]); rptr.DataBind(); } }
/// <summary> /// Check if any reqsn with same catalogue in Draft mode. /// </summary> protected void CreateNewRequisition() { using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase()) { IventoryItemData objDoInventory = new IventoryItemData(); objDoInventory.POType = ddlPOType.SelectedValue.ToString(); objDoInventory.VesselCode = ddlVessel.SelectedValue.ToString(); objDoInventory.Department = ddlFunction.SelectedValue.ToString(); objDoInventory.DocumentNumber = "1"; objDoInventory.Totalitem = 0; objDoInventory.LineType = "R"; objDoInventory.CreatedBy = GetSessionUserID().ToString(); objDoInventory.UserName = GetSessionUserName().ToString().Split(new char[] { ' ' })[0]; objDoInventory.UrgencyCode = ddlUrgency.SelectedValue; objDoInventory.Account_Type = ddlAccountType.SelectedValue; objDoInventory.RequisitionType = ddlReqsnType.SelectedValue; objDoInventory.SystemCode = ddlCatalogue.SelectedValue; if (ddlDeliveryPort.SelectedValue != "0" && ddlDeliveryPort.SelectedValue != "") { objDoInventory.Delivery_Port = Convert.ToInt16(ddlDeliveryPort.SelectedValue);//Convert.ToInt16(Session["DeliveryPort"]); } else { objDoInventory.Delivery_Port = 0; } objDoInventory.Delivery_Date = UDFLib.ConvertToDate(txtDeliveryDate.Text); objDoInventory.Port_Call = Convert.ToInt16(ddlPortCall.SelectedValue); objDoInventory.Owner_Code = ddlOwnerName.SelectedValue; DataSet ds = BLL_PURC_Common.PURC_Checking_Requisition(objDoInventory); if (ds.Tables[0].Rows.Count > 0) { pnlViewRequisition.Visible = true; pnlNewRequisition.Visible = false; ddlRequisitionList.DataSource = ds.Tables[0]; ddlRequisitionList.DataTextField = "requisition_code"; ddlRequisitionList.DataValueField = "DOCUMENT_CODE"; ddlRequisitionList.DataBind(); ddlRequisitionList.Items.Insert(0, new ListItem("-SELECT-", "0")); ddlRequisitionList.SelectedIndex = 0; BindRequisition(ddlRequisitionList.SelectedValue); } else { string ReturenID = objTechService.GenerateRequisitionNumber(objDoInventory); if (ReturenID != "") //(dtReqsn_DocumentCode.Rows.Count >0) { ViewState["flt_DocumentCode"] = ReturenID; //Convert.ToString(dt.Rows[0]["DOCUMENT_CODE"]); Session["DocumentCode"] = ReturenID; Response.Redirect("PURC_Reqn_Items.aspx?DocumentCode=" + ViewState["flt_DocumentCode"] + ""); } } } }
/// <summary> /// Insert Duplicate reqs of selected reqsn. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { try { //TechnicalBAL objtechBAL = new TechnicalBAL(); DataSet ds = BLL_PURC_Common.PURC_INS_Duplicate_RequisitionDeatils(hdnDocumentCode.Value, UDFLib.ConvertToInteger(ddlVessel.SelectedValue), UDFLib.ConvertToInteger(ddlDeliveryPort.SelectedValue), txtDeliveryDate.Text, GetSessionUserID(), GetSessionUserName()); if (ds.Tables[0].Rows.Count > 0) { DataSet dataforDisplay; using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase()) { dataforDisplay = objTechService.GetReqItemsPreview(null, ddlVessel.SelectedValue, ds.Tables[0].Rows[0]["DOCUMENT_CODE"].ToString()); } if (dataforDisplay.Tables[0].Rows.Count > 0) { if (dataforDisplay.Tables[1].Rows.Count > 0) { if (dataforDisplay.Tables[1].Rows[0]["Direct_Quotation"].ToString() == "True") { ResponseHelper.Redirect("ItemPreview.aspx?Requisitioncode=" + "" + "&Vessel_Code=" + ddlVessel.SelectedValue.ToString() + "&Document_Code=" + ds.Tables[0].Rows[0]["DOCUMENT_CODE"].ToString(), "_self", ""); string msgDraft = String.Format("parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDraft", msgDraft, true); } else { ResponseHelper.Redirect("RequisitionPreview.aspx?Requisitioncode=" + "" + "&Vessel_Code=" + ddlVessel.SelectedValue.ToString() + "&Document_Code=" + ds.Tables[0].Rows[0]["DOCUMENT_CODE"].ToString(), "_self", ""); string msgDraft = String.Format("parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDraft", msgDraft, true); } } else { // String msg = String.Format("alert('Requisition has deleted'); window.close();"); String msg = String.Format("alert('No Preview configured for this PO Type.');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); string msgDraft = String.Format("parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDraft", msgDraft, true); } } else { String msg = String.Format("alert('Error While Saving Record.');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true); string msgDraft = String.Format("parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDraft", msgDraft, true); } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }