Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // show office portage only if office portage bill has been considered for any joining type//



        string arg = Request.QueryString["arg"].ToString();

        string[] arr;
        if (arg != null && arg.Length > 0)
        {
            arr = arg.Split('~');

            ViewState["Vessel_ID"]   = UDFLib.ConvertToInteger(arr[0]);
            ViewState["PBDt"]        = DateTime.Parse(arr[1]);
            ViewState["Vessel_Name"] = arr[2];
        }

        if (UDFLib.ConvertToInteger(ViewState["Vessel_ID"]) > 0)
        {
            BLL_Crew_Admin objAdm  = new BLL_Crew_Admin();
            DataTable      dtJtype = objAdm.Get_JoiningType_List(null);

            BLL_Infra_VesselLib objVsl = new BLL_Infra_VesselLib();
            DataTable           dtVsl  = objVsl.GetVesselDetails_ByID(Convert.ToInt32(ViewState["Vessel_ID"]));

            if (dtJtype.Rows.Count > 0 && dtVsl.Rows.Count > 0)
            {
                // for office vessel only
                if (dtJtype.Select("OfficePortageBillConsidered=1").Length > 0 && UDFLib.ConvertToInteger(dtVsl.Rows[0]["ISVESSEL"]) == 0)
                {
                    btnGeneratePortageBill.Visible = true;
                    btnFinalizePortageBill.Visible = true;
                    DataTable dtOPPbill = BLL_PB_PortageBill.Get_Open_PortageBill();
                    if (dtOPPbill.Rows.Count > 0 && Convert.ToString(dtOPPbill.Rows[0]["GENERATE_PB"]).Trim().Length > 1)
                    {
                        ViewState["Open_PB_Month"] = Convert.ToDateTime(dtOPPbill.Rows[0]["PB_GEN_DATE"]).Month;
                        ViewState["Open_PB_Year"]  = Convert.ToDateTime(dtOPPbill.Rows[0]["PB_GEN_DATE"]).Year;
                    }

                    // if open pbill is same as requested then generate pbill //
                    if (int.Parse(ViewState["Open_PB_Month"].ToString()) == DateTime.Parse(ViewState["PBDt"].ToString()).Month&& int.Parse(ViewState["Open_PB_Year"].ToString()) == DateTime.Parse(ViewState["PBDt"].ToString()).Year)
                    {
                        BLL_PB_PortageBill.Upd_Generate_PortageBill(ViewState["Open_PB_Month"].ToString(), ViewState["Open_PB_Year"].ToString(), Convert.ToInt32(ViewState["Vessel_ID"]), Convert.ToInt32(Session["USERID"]), null);
                    }
                    else
                    {
                        btnGeneratePortageBill.Visible = false;
                        btnFinalizePortageBill.Visible = false;
                    }
                }
                else
                {
                    btnGeneratePortageBill.Visible = false;
                    btnFinalizePortageBill.Visible = false;
                }
            }


            Load_PortageBill();
        }


        UserAccessValidation();
    }