コード例 #1
0
    private void BindFieldsAfterSave()
    {
        DataTable dtInfo = BLL_PURC_CTP.Get_Ctp_Contract_Info(Convert.ToInt32(Request.QueryString["Quotation_ID"]));

        if (dtInfo.Rows.Count > 0)
        {
            ListItem liCurrency = DDLCurrency.Items.FindByText(dtInfo.Rows[0]["currency"].ToString());
            if (liCurrency != null)
            {
                DDLCurrency.ClearSelection();
                liCurrency.Selected = true;
            }
            txtBargeCharge.Text   = dtInfo.Rows[0]["Barge_Charge"].ToString();
            txtDiscount.Text      = dtInfo.Rows[0]["Discount"].ToString();
            txtFrieghtCharge.Text = dtInfo.Rows[0]["Freight_Charge"].ToString();
            txtOtherCharge.Text   = dtInfo.Rows[0]["Other_Charge"].ToString();
            txtPkgCharge.Text     = dtInfo.Rows[0]["Pkg_Hld_Charge"].ToString();
            txtTruckCharge.Text   = dtInfo.Rows[0]["Truck_Charge"].ToString();
            txtVat.Text           = dtInfo.Rows[0]["Vat"].ToString();


            lblApprovedItem_count.Text = "Item Count :-   Approved : " + dtInfo.Rows[0]["APPROVED_ITEM_COUNT"].ToString() + ",   Un Approved : " + dtInfo.Rows[0]["NOT_APPROVED_ITEM_COUNT"].ToString();

            if (dtInfo.Rows[0]["Quotation_Status"].ToString() == "FZ" || dtInfo.Rows[0]["Quotation_Status"].ToString() == "AP")
            {
                btnSaveAsDraft.Enabled          = false;
                btnSubmittoseach.Enabled        = false;
                hdf_Quotation_Save_Status.Value = "1";
                hlnkAddItem.Visible             = false;
            }
            else
            {
                btnSaveAsDraft.Enabled          = true;
                btnSubmittoseach.Enabled        = true;
                hdf_Quotation_Save_Status.Value = "0";
                hlnkAddItem.Visible             = true;
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (AjaxFileUpload1.IsInFileUploadPostBack)
        {
        }
        else
        {
            UserAccessValidation();
            // lblLogisticId.Attributes.Add("style", "visibility:hidden");
            lblMessage.Visible              = false;
            ViewState["deleted"]            = "false";
            uc_SupplierList1.Web_Method_URL = "/" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "/JibeWebService.asmx/asyncGet_Supplier_List";
            ctlPortList1.Web_Method_URL     = "/" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "/JibeWebService.asmx/asyncGet_Port_List";

            btnLoadFiles.Attributes.Add("style", "visibility:hidden");
            if (!IsPostBack)
            {
                FillDDLs();

                imgbtnPurchaserRemark.Attributes.Add("onmouseover", "ASync_Get_Log_Remark(" + Request.QueryString["LOG_ID"] + ",event,this,0,3)");
                DataSet dsLog = BLL_PURC_LOG.Get_Log_Logistic_PO_Details(UDFLib.ConvertToInteger(Request.QueryString["LOG_ID"]));


                ViewState["Dept_Code"] = dsLog.Tables[1].Rows[0]["DEPARTMENT"].ToString();

                ViewState["deleted"] = Convert.ToString(dsLog.Tables[0].Rows[0]["active_status"]) == "0" ? true : false;

                // lblVesselName.Text = dsLog.Tables[0].Rows[0]["Vessel_Name"].ToString();
                lblLpoCode.Text = Request.QueryString["LOG_ID"];
                string wh       = "LOG_ID=" + Request.QueryString["LOG_ID"];
                string msgmodal = String.Format(" Get_Record_Information_Details('PURC_LIB_LOG_PO','" + wh + "');");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Get_Record", msgmodal, true);
                Session["LOG_ID"] = Request.QueryString["LOG_ID"].ToString();

                // ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Get_records", "Get_records();", true);
                try
                {
                    DDLCurrency.ClearSelection();

                    if (DDLCurrency.Items.FindByText(dsLog.Tables[0].Rows[0]["Currency"].ToString()) != null)
                    {
                        DDLCurrency.Items.FindByText(dsLog.Tables[0].Rows[0]["Currency"].ToString()).Selected = true;
                        if (dsLog.Tables[3].Rows.Count > 0)
                        {
                            hdfExchrate.Value = dsLog.Tables[3].Rows[0]["ExchRate"].ToString();
                        }
                    }

                    ddlHub.ClearSelection();

                    if (ddlHub.Items.FindByValue(dsLog.Tables[0].Rows[0]["Hub"].ToString()) != null)
                    {
                        ddlHub.Items.FindByValue(dsLog.Tables[0].Rows[0]["Hub"].ToString()).Selected = true;
                    }

                    ddlAgentFord.ClearSelection();

                    if (ddlAgentFord.Items.FindByValue(dsLog.Tables[0].Rows[0]["Supplier_Code"].ToString()) != null)
                    {
                        ddlAgentFord.Items.FindByValue(dsLog.Tables[0].Rows[0]["Supplier_Code"].ToString()).Selected = true;
                    }


                    rbtnlistPOType.ClearSelection();

                    if (rbtnlistPOType.Items.FindByValue(dsLog.Tables[0].Rows[0]["PO_Type"].ToString()) != null)
                    {
                        rbtnlistPOType.Items.FindByValue(dsLog.Tables[0].Rows[0]["PO_Type"].ToString()).Selected = true;
                    }

                    rbtnlistCostType.ClearSelection();

                    if (rbtnlistCostType.Items.FindByValue(dsLog.Tables[0].Rows[0]["Cost_Type"].ToString()) != null)
                    {
                        rbtnlistCostType.Items.FindByValue(dsLog.Tables[0].Rows[0]["Cost_Type"].ToString()).Selected = true;
                    }

                    uc_SupplierList1.SelectedValue = dsLog.Tables[0].Rows[0]["PO_Supplier"].ToString();


                    ctlPortList1.SelectedValue = Convert.ToString(dsLog.Tables[0].Rows[0]["Port"]);


                    //ctlPortList1.SelectedValue = dsLog.Tables[0].Rows[0]["Port"].ToString();

                    gvAttachment.DataSource = BLL_PURC_LOG.Get_Log_Attachment(Request.QueryString["LOG_ID"]);
                    gvAttachment.DataBind();
                }
                catch { }

                dlReqsnPOs.DataSource = dsLog.Tables[1];
                dlReqsnPOs.DataBind();

                if (dsLog.Tables[2].Rows.Count == 0) // creating new PO
                {
                    ViewState["IsCreatingNewPO"] = true;
                    // create  rows based on vessels selected for logistic po
                    DataRow   dr;
                    DataTable dtVesselsInLPO = BLL_PURC_LOG.Get_VesselInLogisticPO(UDFLib.ConvertToInteger(Request.QueryString["LOG_ID"]));
                    if (dtVesselsInLPO.Rows.Count == 1)
                    {
                        dr              = dsLog.Tables[2].NewRow();
                        dr["item_id"]   = 0;
                        dr["vessel_id"] = 0;
                        dsLog.Tables[2].Rows.Add(dr);
                    }
                    else
                    {
                        foreach (DataRow drvsl in dtVesselsInLPO.Rows)
                        {
                            dr              = dsLog.Tables[2].NewRow();
                            dr["item_id"]   = 0;
                            dr["vessel_id"] = drvsl["vessel_id"];
                            dsLog.Tables[2].Rows.Add(dr);
                        }
                    }

                    gvItemList.DataSource = dsLog.Tables[2];
                    gvItemList.DataBind();


                    if (dsLog.Tables[1].Rows.Count == 1)// select single po option
                    {
                        rbtnlistPOType.Items.FindByValue("SPO").Selected = true;
                    }
                    else
                    {
                        rbtnlistPOType.Items.FindByValue("CPO").Selected = true;
                    }
                }
                else
                {
                    ViewState["IsCreatingNewPO"] = false;
                    gvItemList.DataSource        = dsLog.Tables[2];
                    gvItemList.DataBind();

                    string CalculateTotal = String.Format("CalculateTotal();");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "CalculateTotal", CalculateTotal, true);
                }

                ViewState["dtGridItems"] = dsLog.Tables[2];


                lstUserList.DataSource = BLL_PURC_LOG.Get_Log_Logistic_Approver();
                lstUserList.DataBind();
                lstUserList.Items.Insert(0, new ListItem("SELECT", "0"));
                lstUserList.SelectedIndex = 0;
                ListItem itemrmv = lstUserList.Items.FindByValue(Session["userid"].ToString());
                lstUserList.Items.Remove(itemrmv);



                //ucPurcAttachment1.ReqsnNumber = Request.QueryString["LOG_ID"].ToString();
                //ucPurcAttachment1.UserID = Session["USERID"].ToString();
                //ucPurcAttachment1.FileUploadPath = Server.MapPath("../Uploads/Purchase");
                //ucPurcAttachment1.VesselID = "0";

                ASP.global_asax.AttachedFile = "";
                Session["PURCATTACHEDFILES"] = "";


                DataTable dtDeletedPOs = BLL_PURC_LOG.Get_Log_Deleted_LPO(Request.QueryString["LOG_ID"]);
                if (dtDeletedPOs.Rows.Count > 0)
                {
                    gvDeletedPOs.DataSource = dtDeletedPOs;
                    gvDeletedPOs.DataBind();
                }
                else
                {
                    lbllblexpand.Visible = false;
                    pnldeletedpo.Visible = false;
                }
            }


            if (IsPostBack)
            {
                // ucPurcAttachment1.Register_JS_Attach();
                Session["PURCATTACHEDFILES"] = ASP.global_asax.AttachedFile;
            }

            btnShowCnacelLPO.Visible = false;

            if (UDFLib.ConvertToInteger(Request.QueryString["IsApproving"]) == 0)
            {
                pnlApprove.Visible = false;
            }
            else
            {
                btnSavePODetails.Visible   = false;
                btnDeleteLO.Enabled        = false;
                btnSendForApproval.Visible = false;
                foreach (DataListItem item in dlReqsnPOs.Items)
                {
                    (item.FindControl("imgbtnDelete") as ImageButton).Visible = false;
                }

                foreach (GridViewRow gr in gvItemList.Rows)
                {
                    (gr.FindControl("imgbtnDeleteitem") as ImageButton).Visible = false;
                }
                (gvItemList.FooterRow.FindControl("btnAddNewItem") as Button).Visible = false;
            }

            if (UDFLib.ConvertToInteger(Request.QueryString["IsApproved"]) == 1)
            {
                pnlApprove.Visible         = false;
                btnSavePODetails.Visible   = false;
                btnDeleteLO.Enabled        = false;
                btnSendForApproval.Visible = false;
                foreach (DataListItem item in dlReqsnPOs.Items)
                {
                    (item.FindControl("imgbtnDelete") as ImageButton).Visible = false;
                }

                foreach (GridViewRow gr in gvItemList.Rows)
                {
                    (gr.FindControl("imgbtnDeleteitem") as ImageButton).Visible = false;
                    (gr.FindControl("ddlpovessels") as DropDownList).Enabled    = false;
                }
                (gvItemList.FooterRow.FindControl("btnAddNewItem") as Button).Visible = false;

                btnShowCnacelLPO.Visible = true;
            }


            DisableOnDeleted();
        }
    }