protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         DateFormat         = UDFLib.GetDateFormat();
         calFromDate.Format = calToDate.Format = UDFLib.GetDateFormat();
         if (Request.QueryString.Count != 0)
         {
             if (Request.QueryString["VesselId"] != null && Request.QueryString["VesselId"] != "")
             {
                 VesselId = Convert.ToInt16(Request.QueryString["VesselId"].ToString());
             }
             if (Request.QueryString["InspectionType"] != null && Request.QueryString["InspectionType"] != "")
             {
                 InspectionType = Request.QueryString["InspectionType"].ToString();
             }
         }
         if (!IsPostBack)
         {
             if (Request.QueryString.Count != 0)
             {
                 if (Request.QueryString["Status"] != null && Request.QueryString["Status"] != "")
                 {
                     Status = Request.QueryString["Status"].ToString();
                 }
                 if (Request.QueryString["IssueDate"] != null && Request.QueryString["IssueDate"] != "")
                 {
                     IssueDate = UDFLib.ConvertToDate(Request.QueryString["IssueDate"].ToString());
                     txtInspectionFromDate.Text = UDFLib.ConvertUserDateFormat(IssueDate.ToShortDateString(), DateFormat);
                 }
             }
             BindPort();
             ddlStatus.ClearSelection();
             ddlStatus.Items.FindByValue(Status).Selected = true;
             DataSet ds = objInsp.Get_Current_Schedules(Status, VesselId, IssueDate.ToShortDateString().Equals("01/01/0001") ? null : UDFLib.ConvertDateToNull(IssueDate), null, 0);
             gvInspectionSchedule.DataSource = ds.Tables[0];
             gvInspectionSchedule.DataBind();
         }
     }
     catch (Exception ex)
     {
         UDFLib.WriteExceptionLog(ex);
     }
 }
Beispiel #2
0
    protected void Load_Current_Schedules()
    {
        try
        {
            string sortbycoloumn   = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            string sortdirection   = (ViewState["SORTDIRECTION"] == null) ? "" : (ViewState["SORTDIRECTION"].ToString() == "1") ? " DESC" : "ASC";
            string Sort_Expression = sortbycoloumn + sortbycoloumn;

            string Frequency_Type   = ddlScheduleType.SelectedIndex <= 0 ? null : ddlScheduleType.SelectedValue;
            int    Last_Run_Success = -1;
            string Status           = null;
            string SearchText       = "";
            int?   InspectionType   = null;
            int?   OverDue          = null;
            if (ddlStatus.SelectedIndex > 0)
            {
                Status = ddlStatus.SelectedValue;
                if (ddlStatus.SelectedValue == "Overdue")
                {
                    Status  = "Pending";
                    OverDue = 1;
                }
            }
            if (ddlInspectionType.SelectedIndex > 0)
            {
                InspectionType = UDFLib.ConvertToInteger(ddlInspectionType.SelectedValue);
            }

            if (ViewState["SORTBYCOLOUMN"] == null)
            {
                ViewState["SORTBYCOLOUMN"] = "Schedule_Date";
            }
            if (ViewState["SORTDIRECTION"] == null)
            {
                ViewState["SORTDIRECTION"] = "desc";
            }

            string  sortexp        = ViewState["SORTBYCOLOUMN"].ToString() + " " + ViewState["SORTDIRECTION"].ToString();
            int     is_Fetch_Count = ucCustomPagerItems.isCountRecord;
            DataSet ds             = objInsp.Get_Current_Schedules(InspectionId, Frequency_Type, Last_Run_Success, Status, SearchText, GetSessionUserID(), ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref is_Fetch_Count, UDFLib.ConvertIntegerToNull(DDLVessel.SelectedIndex == 0 ? null : DDLVessel.SelectedValue), UDFLib.ConvertIntegerToNull(DDLInspector.SelectedIndex == 0 ? null : DDLInspector.SelectedValue), UDFLib.ConvertDateToNull(txtFromDate.Text), UDFLib.ConvertDateToNull(txtToDate.Text), InspectionType, OverDue, sortexp, UDFLib.ConvertIntegerToNull(DDLFleet.SelectedIndex == 0 ? null : DDLFleet.SelectedValue));

            tbl_Inspection.Visible = false;
            if (ds != null)
            {
                if (InspectionId != 0)
                {
                    tbl_Inspection.Visible  = true;
                    lblCertificateName.Text = Convert.ToString(Request.QueryString["CertificateName"]);
                }

                gvInspecrionSchedule.DataSource = ds.Tables[0];
                gvInspecrionSchedule.DataBind();

                ucCustomPagerItems.CountTotalRec = is_Fetch_Count.ToString();
                ucCustomPagerItems.BuildPager();
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }