示例#1
0
        public DataSet Get_SurvayList(int FleetID, int VesselID, int MainCategoryId, int CategoryID, int CertificateID, string IssueFrom, string IssueTo, string ExpFrom, string ExpTo, int ExpiryInDays, int Verified, string SearchText, Boolean ShowAll, string CatIDList, int?PAGE_SIZE, int?PAGE_INDEX, int?SelectRecordCount)
        {
            DateTime dt  = DateTime.Parse("1900/01/01");
            DateTime dt1 = DateTime.Parse("9999/01/01");

            DateTime dtIssueFrom = IssueFrom == "" ? dt : UDFLib.ConvertToDate(IssueFrom, UDFLib.GetDateFormat());
            DateTime dtIssueTo   = IssueTo == "" ? dt1 : UDFLib.ConvertToDate(IssueTo, UDFLib.GetDateFormat());
            DateTime dtExpFrom   = ExpFrom == "" ? dt : UDFLib.ConvertToDate(ExpFrom, UDFLib.GetDateFormat());
            DateTime dtExpTo     = ExpTo == "" ? dt1 : UDFLib.ConvertToDate(ExpTo, UDFLib.GetDateFormat());


            //Overdue = -1 //Custom Dates =0
            if (ExpiryInDays == -1)
            {
                //Overdue
                dtExpTo = UDFLib.ConvertToDate(DateTime.Today.ToString(UDFLib.GetDateFormat()), UDFLib.GetDateFormat()).AddDays(1);
            }
            else if (ExpiryInDays == 0)
            {
                //Custom Dates
            }
            else
            {
                //30, 60, 90 days
                //dtExpFrom = DateTime.Parse(DateTime.Today.ToString("yyyy/MM/dd")); - Changed on 05/05/2011
                dtExpTo = UDFLib.ConvertToDate(DateTime.Today.ToString(UDFLib.GetDateFormat()), UDFLib.GetDateFormat()).AddDays(ExpiryInDays);
            }

            return(objDLL.Get_SurvayList_DL(FleetID, VesselID, MainCategoryId, CategoryID, CertificateID, dtIssueFrom, dtIssueTo, dtExpFrom, dtExpTo, Verified, SearchText, ExpiryInDays, ShowAll, CatIDList, PAGE_SIZE, PAGE_INDEX, SelectRecordCount));
        }
示例#2
0
    /// <summary>
    /// Description: If by voyage is selected , for all vessels voyage ddl wil populate based on search date
    /// </summary>
    protected void ddlVoyage_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            DateTime?Startdate = null;
            //Startdate = Convert.ToDateTime(txtStartDate.Text);
            Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
            DateTime?EndDate = null;
            //EndDate = Convert.ToDateTime(txtEndDate.Text);
            EndDate = Convert.ToDateTime(UDFLib.ConvertToDate(txtEndDate.Text));
            DropDownList ddlVoyage = (DropDownList)sender;
            GridDataItem item      = (GridDataItem)ddlVoyage.NamingContainer;
            Label        txtSrno   = (Label)item.FindControl("Vessel_Average");
            HiddenField  hdf       = (HiddenField)item.FindControl("hdVesselID");
            LinkButton   lnkVessel = (LinkButton)item.FindControl("Item_Name");
            if (ddlVoyage.SelectedIndex != 0)
            {
                string    val = ddlVoyage.SelectedValue.Trim().Split(':')[0] + ":" + ddlVoyage.SelectedValue.Trim().Split(':')[1];
                DataTable dtq = BLL_TMSA_PI.GetTelDate(val.Trim(), Convert.ToInt32(hdf.Value)).Tables[0];

                if (dtq.Rows[0][0].ToString() != "")
                {
                    Startdate = Convert.ToDateTime(dtq.Rows[0][1].ToString());

                    hiddenStartDate.Value = Startdate.Value.Date.ToString("dd-MM-yyyy");
                }
                if (dtq.Rows[dtq.Rows.Count - 1][0].ToString() != "")
                {
                    EndDate             = Convert.ToDateTime(dtq.Rows[dtq.Rows.Count - 1][1].ToString());
                    hiddenEndDate.Value = EndDate.Value.Date.ToString("dd-MM-yyyy");
                }
            }
            DataTable dt = BLL_TMSA_PI.GetVoyageDataNOx(ddlVoyage.SelectedValue.Trim(), Convert.ToInt32(hdf.Value)).Tables[0];
            if (dt.Rows.Count > 0)
            {
                txtSrno.Text = Math.Round(Convert.ToDouble(dt.Rows[0]["Value"].ToString()), 2).ToString();
                if (Convert.ToDouble(dt.Rows[0]["Value"]) == 0)
                {
                    lnkVessel.Enabled        = false;
                    item["Vessel"].BackColor = System.Drawing.Color.White;
                }
                else
                {
                    lnkVessel.Enabled = true;
                }
            }
            else
            {
                txtSrno.Text             = "0";
                lnkVessel.Enabled        = false;
                item["Vessel"].BackColor = System.Drawing.Color.White;
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#3
0
    protected void btnSavePlanning_Click(object sender, EventArgs e)
    {
        try
        {
            int iCrewID = int.Parse(hdnCrewID.Value);
            if (iCrewID == 0)
            {
                lblMessage.Text = "Please select a crew from the above list to plan an Briefing";
                return;
            }
            if (int.Parse(ddlPlanInterviewer.SelectedValue) == 0)
            {
                lblMessage.Text = "Please Select Briefer";
                return;
            }
            if (txtPlanDate.Text.Trim().Equals(""))
            {
                lblMessage.Text = "Please Enter Date" + TodayDateFormat;
                return;
            }
            if (int.Parse(ddlInterviewSheet.SelectedValue) == 0)
            {
                lblMessage.Text = "Please Select Briefing Sheet";
                return;
            }
            string PlanDateTime = UDFLib.ConvertToDate(txtPlanDate.Text, UDFLib.GetDateFormat()).ToShortDateString() + " " + ddlPlanH.Text + ":" + ddlPlanM.Text;
            if (int.Parse(ddlPlanH.Text) < 12)
            {
                PlanDateTime += " AM";
            }
            else
            {
                PlanDateTime += " PM";
            }

            string TimeZone     = ddlTimeZone.SelectedValue;
            int    iInterviewID = objCrewBLL.INS_CrewInterviewPlanning(iCrewID, 0, txtPlanCrewName.Text, PlanDateTime, int.Parse(ddlPlanInterviewer.SelectedValue), "", GetSessionUserID(), TimeZone, "Briefing", int.Parse(ddlInterviewSheet.SelectedValue));
            gvCrewBriefPlan.DataBind();
            hdnInterviewID.Value = iInterviewID.ToString();
            if (iInterviewID > 0)
            {
                lblMessage.Text = "Briefing planned for " + txtPlanCrewName.Text;
                SendMail_InterviewPlanning(iInterviewID);
                string js = "parent.GetInterviewResult(" + iCrewID + ");";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
            }
            else
            {
                lblMessage.Text = "Briefing already planned for " + txtPlanCrewName.Text + " at same time " + PlanDateTime;
            }
        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.Message;
        }
    }
示例#4
0
    /// <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"] + "");
                }
            }
        }
    }
 protected void ObjectDataSource2_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     try
     {
         e.InputParameters["REFERENCE_DATE"] = UDFLib.ConvertToDate(e.InputParameters["REFERENCE_DATE"].ToString()).ToShortDateString();
     }
     catch (Exception ex)
     {
         UDFLib.WriteExceptionLog(ex);
     }
 }
示例#6
0
    protected void ImgExportToExcel_Click(object sender, EventArgs e)
    {
        string Sign_On_From      = "";
        string Sign_On_To        = "";
        string SearchString      = txtSearch.Text;
        int    TotalDays         = 0;
        int    PAGE_SIZE         = -1;
        int    PAGE_INDEX        = -1;
        int    SelectRecordCount = 0;

        int FleetCode = UDFLib.ConvertToInteger(ddlFleet.SelectedValue);
        int VesselID  = UDFLib.ConvertToInteger(ddlVessel.SelectedValue);

        if (txtSignOnFrom.Text != "")
        {
            Sign_On_From = UDFLib.ConvertToDate(Convert.ToString(txtSignOnFrom.Text), UDFLib.GetDateFormat()).ToString();
        }

        if (txtSignOnTo.Text != "")
        {
            Sign_On_To = UDFLib.ConvertToDate(Convert.ToString(txtSignOnTo.Text), UDFLib.GetDateFormat()).ToString();
        }

        DataTable dt = BLL_Crew_CrewList.Get_Super_Att_Vessel_Report(FleetCode, VesselID, Sign_On_From, Sign_On_To, SearchString, GetSessionUserID(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, ref TotalDays);

        dt.Columns.Add("Joining_Date1");
        dt.Columns.Add("Sign_On_Date1");
        dt.Columns.Add("Sign_Off_Date1");

        foreach (DataRow dr in dt.Rows)
        {
            if (dr["Joining_Date"].ToString() != "" && dr["Joining_Date"] != null)
            {
                dr["Joining_Date1"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Joining_Date"]), Convert.ToString(Session["User_DateFormat"]));
            }
            if (dr["Sign_On_Date"].ToString() != "" && dr["Sign_On_Date"] != null)
            {
                dr["Sign_On_Date1"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Sign_On_Date"]));
            }

            if (dr["Sign_Off_Date"].ToString() != "" && dr["Sign_Off_Date"] != null)
            {
                dr["Sign_Off_Date1"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dr["Sign_Off_Date"]));
            }
        }
        dt.AcceptChanges();

        string[] HeaderCaptions  = { "Vessel", "S/Code", "Name", "Rank", "Contract Date", "S/On Date", "S/Off Date", "Days ONBD" };
        string[] DataColumnsName = { "Vessel_Short_Name", "Staff_Code", "Staff_Name", "Rank_Short_Name", "Joining_Date1", "Sign_On_Date1", "Sign_Off_Date1", "DaysOnBoard" };


        GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "Superintendents_attending_vessels.xls", "Superintendents attending vessels Report");
    }
    protected void BindRJBGrid()
    {
        DateTime dtFrom = DateTime.Parse("1900/01/01");
        DateTime dtTo   = DateTime.Parse("2900/01/01");

        if (txtSearchJoinFromDate.Text != "")
        {
            dtFrom = UDFLib.ConvertToDate(txtSearchJoinFromDate.Text.ToString(), UDFLib.GetDateFormat());
        }

        if (txtSearchJoinToDate.Text != "")
        {
            dtTo = UDFLib.ConvertToDate(txtSearchJoinToDate.Text.ToString(), UDFLib.GetDateFormat());
        }

        DateTime dtExpectFrom = DateTime.Parse("1900/01/01");
        DateTime dtExpectTo   = DateTime.Parse("2900/01/01");

        if (txtExpectedFromDate.Text != "")
        {
            dtExpectFrom = UDFLib.ConvertToDate(txtExpectedFromDate.Text.ToString(), UDFLib.GetDateFormat());
        }

        if (txtExpectedToDate.Text != "")
        {
            dtExpectTo = UDFLib.ConvertToDate(txtExpectedToDate.Text.ToString(), UDFLib.GetDateFormat());
        }

        int PAGE_SIZE  = ucCustomPagerItems.PageSize;
        int PAGE_INDEX = ucCustomPagerItems.CurrentPageIndex;

        int SelectRecordCount = ucCustomPagerItems.isCountRecord;

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }

        DataTable dt = objCrew.Get_RJBList_Index(UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), UDFLib.ConvertIntegerToNull(ddlStaus.SelectedValue), dtFrom.ToString("yyyy/MM/dd"), dtTo.ToString("yyyy/MM/dd"),
                                                 UDFLib.ConvertIntegerToNull(ddlCurrentVessel.SelectedValue), dtExpectFrom.ToString("yyyy/MM/dd"), dtExpectTo.ToString("yyyy/MM/dd"), txtSearchText.Text.Trim(),
                                                 GetSessionUserID(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, sortbycoloumn, sortdirection);


        GridView1.DataSource = dt;
        GridView1.DataBind();

        if (ucCustomPagerItems.isCountRecord == 1)
        {
            ucCustomPagerItems.CountTotalRec = SelectRecordCount.ToString();
            ucCustomPagerItems.BuildPager();
        }
    }
示例#8
0
    protected void ObjectDataSource2_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        if (e.InputParameters["InterviewPlanDate"].ToString() != null)
        {
            if (!UDFLib.DateCheck(e.InputParameters["InterviewPlanDate"].ToString()))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "jsSqlError2", "alert('Enter valid Date" + UDFLib.DateFormatMessage() + "');", true);
                return;
            }
        }

        e.InputParameters["InterviewPlanDate"] = UDFLib.ConvertToDate(e.InputParameters["InterviewPlanDate"].ToString()).ToShortDateString();
        InterviewID = int.Parse(e.InputParameters["Id"].ToString());
    }
示例#9
0
    protected DataTable GetSearchDataTable()
    {
        DataTable dtFilters = new DataTable();

        dtFilters.Columns.Add("VesselManager", typeof(int));
        dtFilters.Columns.Add("Fleet", typeof(int));
        dtFilters.Columns.Add("Vessel", typeof(int));
        dtFilters.Columns.Add("RankID", typeof(int));
        dtFilters.Columns.Add("Nationality", typeof(int));
        dtFilters.Columns.Add("Status", typeof(int));
        dtFilters.Columns.Add("CalculatedStatus", typeof(int));
        dtFilters.Columns.Add("ManningOfficeID", typeof(int));
        dtFilters.Columns.Add("EOCDueIn", typeof(int));
        dtFilters.Columns.Add("JoiningDateFrom", typeof(String));
        dtFilters.Columns.Add("JoiningDateTo", typeof(String));
        dtFilters.Columns.Add("SearchText", typeof(String));

        DateTime dtFrom = DateTime.Parse("1900/01/01");
        DateTime dtTo   = DateTime.Parse("2900/01/01");

        if (txtSearchJoinFromDate.Text != "")
        {
            dtFrom = UDFLib.ConvertToDate(Convert.ToString(txtSearchJoinFromDate.Text), UDFLib.GetDateFormat());
        }

        if (txtSearchJoinToDate.Text != "")
        {
            dtTo = UDFLib.ConvertToDate(Convert.ToString(txtSearchJoinToDate.Text), UDFLib.GetDateFormat());
        }

        dtFilters.Rows.Add(
            1,
            UDFLib.ConvertToInteger(ddlFleet.SelectedValue.ToString()),
            UDFLib.ConvertToInteger(ddlVessel.SelectedValue.ToString()),
            UDFLib.ConvertToInteger(ddlRank.SelectedValue.ToString()),
            UDFLib.ConvertToInteger(ddlCountry.SelectedValue.ToString()),
            UDFLib.ConvertToInteger(ddlMainStatus.SelectedValue.ToString()),
            UDFLib.ConvertToInteger(ddlCalculatedStatus.SelectedValue.ToString()),
            UDFLib.ConvertToInteger(ddlManningOffice.SelectedValue.ToString()),
            UDFLib.ConvertToInteger(ddlCOC.SelectedValue.ToString()),
            dtFrom.ToString("yyyy/MM/dd"),
            dtTo.ToString("yyyy/MM/dd"),
            txtSearchText.Text);

        return(dtFilters);
    }
示例#10
0
 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);
     }
 }
示例#11
0
    protected string CalculatedExpiryDate(string DateOfExpiry, string ExtensionDate, int GraceRange)
    {
        string RangeMax = "", MaxDate = "";

        if (DateOfExpiry != "")
        {
            MaxDate  = DateOfExpiry;
            RangeMax = UDFLib.ConvertToDate(DateOfExpiry).AddDays((GraceRange * 30 / 2)).ToString(UDFLib.GetDateFormat());
            if (GraceRange > 0 && RangeMax != "")
            {
                MaxDate = UDFLib.ConvertToDate(MaxDate) > UDFLib.ConvertToDate(RangeMax) ? MaxDate : RangeMax;
            }
            if (ExtensionDate != "")
            {
                MaxDate = UDFLib.ConvertToDate(MaxDate) > UDFLib.ConvertToDate(ExtensionDate) ? MaxDate : ExtensionDate;
            }
        }
        return(MaxDate);
    }
示例#12
0
    protected void Load_Report()
    {
        int FleetCode = UDFLib.ConvertToInteger(ddlFleet.SelectedValue);
        int VesselID  = UDFLib.ConvertToInteger(ddlVessel.SelectedValue);

        string Sign_On_From = "";
        string Sign_On_To   = "";

        if (txtSignOnFrom.Text != "")
        {
            Sign_On_From = UDFLib.ConvertToDate(Convert.ToString(txtSignOnFrom.Text), UDFLib.GetDateFormat()).ToString();
        }

        if (txtSignOnTo.Text != "")
        {
            Sign_On_To = UDFLib.ConvertToDate(Convert.ToString(txtSignOnTo.Text), UDFLib.GetDateFormat()).ToString();
        }

        string SearchString = txtSearch.Text;

        int PAGE_SIZE         = ucCustomPager_CrewList.PageSize;
        int PAGE_INDEX        = ucCustomPager_CrewList.CurrentPageIndex;
        int SelectRecordCount = ucCustomPager_CrewList.isCountRecord;
        int TotalDays         = 0;

        DataTable dt = BLL_Crew_CrewList.Get_Super_Att_Vessel_Report(FleetCode, VesselID, Sign_On_From, Sign_On_To, SearchString, GetSessionUserID(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, ref TotalDays);

        if (ucCustomPager_CrewList.isCountRecord == 1)
        {
            ucCustomPager_CrewList.CountTotalRec = SelectRecordCount.ToString();
            ucCustomPager_CrewList.BuildPager();
        }
        GridView_Crew.DataSource = dt;
        GridView_Crew.DataBind();
        lblGrandTotal.Text = TotalDays.ToString();
    }
示例#13
0
    protected void gvSeniorityRecords_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            lblmsg.Text = "";
            int      CrewID = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[0].ToString());
            int      CompanySeniorityYear     = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[1].ToString());
            int      CompanySeniorityDays     = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[2].ToString());
            int      CompanySeniorityYear_New = UDFLib.ConvertToInteger(e.NewValues["CompanySeniorityYear"]);
            int      CompanySeniorityDays_New = UDFLib.ConvertToInteger(e.NewValues["CompanySeniorityDays"]);
            string   Remarks = "Updating Company Seniority first time for existing crews";
            DateTime CompanyEffectiveDate_New;

            if ((CompanySeniorityYear_New > 0 || CompanySeniorityDays_New > 0) && (CompanySeniorityYear != CompanySeniorityYear_New || CompanySeniorityDays != CompanySeniorityDays_New))
            {
                if (CompanySeniorityDays_New > 364)
                {
                    lblmsg.Text = "Company Seniority Days cannot be greater than 364";
                }
                if (e.NewValues["CompanyEffective_date"] != null)
                {
                    CompanyEffectiveDate_New = UDFLib.ConvertToDate(Convert.ToString(e.NewValues["CompanyEffective_date"]), UDFLib.GetDateFormat());

                    BLL_PortageBill.Update_CrewCompanySeniority(CrewID, CompanySeniorityYear_New, CompanySeniorityDays_New, Remarks, CompanyEffectiveDate_New, Convert.ToInt32(Session["userid"]));
                }
                else
                {
                    lblmsg.Text = "Company Effective Date is mandatory to update Company Seniority";
                }
            }

            int RankSeniorityYear = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[3].ToString());
            int RankSeniorityDays = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[4].ToString());

            int RankSeniorityYear_New = UDFLib.ConvertToInteger(e.NewValues["RankSeniorityYear"]);
            int RankSeniorityDays_New = UDFLib.ConvertToInteger(e.NewValues["RankSeniorityDays"]);

            Remarks = "Updating Rank Seniority first time for existing crews";

            if ((RankSeniorityYear_New > 0 || RankSeniorityDays_New > 0) && (RankSeniorityYear != RankSeniorityYear_New || RankSeniorityDays != RankSeniorityDays_New))
            {
                GridViewRow row     = (GridViewRow)gvSeniorityRecords.Rows[e.RowIndex];
                int         RankId1 = int.Parse(((DropDownList)row.FindControl("ddlSeniorityRank")).SelectedValue.ToString());

                if (RankSeniorityDays_New > 364)
                {
                    lblmsg.Text = "Rank Seniority Days cannot be greater than 364";
                }
                if (e.NewValues["RankEffective_date"] != null)
                {
                    BLL_PortageBill.Update_CrewRankSeniority(CrewID, RankId1, RankSeniorityYear_New, RankSeniorityDays_New, 0, Remarks, UDFLib.ConvertToDate(e.NewValues["RankEffective_date"].ToString(), UDFLib.GetDateFormat()), Convert.ToInt32(Session["userid"]));
                }
                else
                {
                    lblmsg.Text = "Rank Effective Date is mandatory to update Rank Seniority";
                }
            }
            if (lblmsg.Text.Trim() == "")
            {
                lblmsg.Visible = false;
                gvSeniorityRecords.EditIndex = -1;
                Load_SeniorityRecords();
            }
            else
            {
                lblmsg.Visible = true;
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#14
0
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            int    rowcount      = ucCustomPagerItems.isCountRecord;
            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataTable dt = BLL_PB_PhoneCard.PhoneCord_Kitty_Export(txtSatatus.Text != "" ? txtSatatus.Text : null, null, txtTitle.Text != "" ? txtTitle.Text : null, null, null, null, (DataTable)Session["sVesselCode"], UDFLib.ConvertToDate(txtFromDate.Text.Trim(), UDFLib.GetDateFormat()).ToShortDateString(), UDFLib.ConvertToDate(txtToDate.Text.Trim(), UDFLib.GetDateFormat()).ToShortDateString(), sortbycoloumn, sortdirection
                                                                   , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["DATE_OF_CREATION"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["DATE_OF_CREATION"]));
            }

            string[] HeaderCaptions  = { "Vessel Name", "Request Date", "Card Number", "Card Pin", "Unit", "Title", "Sub Title", "Supplier ", "Voyage" };
            string[] DataColumnsName = { "VESSEL_NAME", "DATE_OF_CREATION", "CARD_NUM", "CARD_PIN", "CARD_UNITS", "TITLE", "SUBTITLE", "Full_NAME", "STAFF_NAME" };

            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "KittyList", "Kitty List");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#15
0
    /// <summary>
    /// Bind all records of vetting
    /// </summary>
    public void Bind_VettingIndex()
    {
        try
        {
            BLL_VET_Index objBLLIndx    = new BLL_VET_Index();
            DataSet       ds            = new DataSet();
            int           rowcount      = ucCustomPagerItems.isCountRecord;
            string        sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?          sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }
            int       IsValid       = 0;
            DataTable dtEXInspector = new DataTable();
            dtEXInspector.Columns.Add("ID");
            DataTable dtInspector = new DataTable();
            dtInspector.Columns.Add("ID");
            foreach (DataRow dr in DDLInspector.SelectedValues.Rows)
            {
                if (dr[0].ToString().Split('_')[1] == "In")
                {
                    dtInspector.Rows.Add(dr[0].ToString().Split('_')[0]);
                }
                if (dr[0].ToString().Split('_')[1] == "Ex")
                {
                    dtEXInspector.Rows.Add(dr[0].ToString().Split('_')[0]);
                }
            }

            DateTime?VetFromDate, VetToDate;
            VetFromDate = txtLVetFromDate.Text.Trim() == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtLVetFromDate.Text));
            VetToDate   = txtLVetToDate.Text.Trim() == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtLVetToDate.Text));

            if (rbtnValid.Checked == true)
            {
                IsValid = 1;
            }
            ds = objBLLIndx.VET_Get_VettingIndex(DDLVessel.SelectedValues, DDLVetType.SelectedValues, DDLStatus.SelectedValues, txtDueDays.Text == "0" ? UDFLib.ConvertToInteger(txtDueDays.Text.Trim()) : UDFLib.ConvertIntegerToNull(txtDueDays.Text.Trim()), IsValid, UDFLib.ConvertToInteger(rbtnObservation.SelectedValue), DDLOilMajor.SelectedValues, dtInspector, dtEXInspector, VetFromDate, VetToDate, DDLJobStatus.SelectedValues, txtVessel.Text != "" ? txtVessel.Text.Trim() : null, sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

            if (ds.Tables.Count > 0)
            {
                ViewState["dtObservationCount"] = ds.Tables[1];
                ViewState["dtNotesCount"]       = ds.Tables[2];
                ViewState["dtResponse"]         = ds.Tables[3];
                ViewState["dtJobsCount"]        = ds.Tables[4];
            }

            if (ucCustomPagerItems.isCountRecord == 1)
            {
                ucCustomPagerItems.CountTotalRec = rowcount.ToString();
                ucCustomPagerItems.BuildPager();
            }
            gvVettingIndex.DataSource = ds.Tables[0];
            gvVettingIndex.DataBind();
            if (ds.Tables[0].Rows.Count > 0)
            {
                btnExport.Enabled = true;
            }
            else
            {
                btnExport.Enabled = false;
            }

            UpdPnlGrid.Update();
            UpdPnlFilter.Update();
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
示例#16
0
    protected void btnSaveInterviewResult_Click(object sender, EventArgs e)
    {
        string js = "";

        try
        {
            int iCrewID         = GetCrewID();
            int iUserID         = GetSessionUserID();
            int InterviewID     = UDFLib.ConvertToInteger(Request.QueryString["ID"]);
            int InterviewerID   = GetSessionUserID();
            int QustionAnswered = 0;
            if (InterviewID > 0)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("QID");
                dt.Columns.Add("SelectedOptionID");
                dt.Columns.Add("NotApplicable");
                dt.Columns.Add("Remarks");

                foreach (GridViewRow gvr in GridView_AssignedCriteria.Rows)
                {
                    CheckBox        chk        = (CheckBox)gvr.FindControl("chkNA");
                    RadioButtonList rdoOptions = (RadioButtonList)gvr.FindControl("rdoOptions");
                    TextBox         txtRemarks = (TextBox)gvr.FindControl("txtRemarks");
                    int             QID        = UDFLib.ConvertToInteger(GridView_AssignedCriteria.DataKeys[gvr.RowIndex].Value);

                    int NotApplicable = -1;
                    if (chk != null)
                    {
                        NotApplicable = chk.Checked == true ? 1 : 0;
                        if (NotApplicable == 1)
                        {
                            QustionAnswered = 1;
                        }
                    }

                    int SelectedOptionID = 0;
                    if (rdoOptions != null)
                    {
                        if (rdoOptions.SelectedIndex != -1)
                        {
                            SelectedOptionID = UDFLib.ConvertToInteger(rdoOptions.SelectedValue.Split(',')[0]);
                            QustionAnswered  = 1;
                        }
                    }
                    string Remarks = "";
                    if (txtRemarks != null)
                    {
                        Remarks = txtRemarks.Text;
                    }
                    DataRow dr = dt.NewRow();
                    dr["QID"] = QID;
                    dr["SelectedOptionID"] = SelectedOptionID;
                    dr["NotApplicable"]    = NotApplicable;
                    dr["Remarks"]          = Remarks;
                    dt.Rows.Add(dr);
                }
                if (QustionAnswered > 0)
                {
                    string InterviewDate = UDFLib.ConvertToDate(Convert.ToString(txtInterviewDate.Text), UDFLib.GetDateFormat()).ToString();
                    int    Ret           = BLL_Crew_Interview.UPDATE_CrewInterviewResult(iCrewID, InterviewID, InterviewerID, InterviewDate, 0, "", "", "", "", iUserID, dt);
                    js = "Briefing result updated";
                    btnSaveInterviewResult.Enabled = false;
                }
                else
                {
                    js = "Answer atleast one question before saving briefing";
                }
            }
            else
            {
                lblMessage.Text = "Please select the crew again to fill the interview result.";
            }
        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.Message;
        }

        if (js.Length > 0)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser3", "alert('" + js + "');", true);
        }
    }
示例#17
0
 protected void ObjectDataSource2_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     e.InputParameters["InterviewPlanDate"] = UDFLib.ConvertToDate(e.InputParameters["InterviewPlanDate"].ToString()).ToShortDateString();
     InterviewID = int.Parse(e.InputParameters["Id"].ToString());
 }
示例#18
0
    protected void btnSaveEvaluation_Click(object sender, EventArgs e)
    {
        try
        {
            int CrewID = UDFLib.ConvertToInteger(Request.QueryString["CrewID"].ToString());
            //int CrewRank = UDFLib.ConvertToInteger(hdnCrewrank.Value);
            int    EID     = UDFLib.ConvertToInteger(Request.QueryString["EID"].ToString());
            string DueDate = UDFLib.ConvertStringToNull(Request.QueryString["DueDate"]);

            if (!string.IsNullOrEmpty(DueDate))
            {
                //  DueDate = DueDate.ToString().Replace('-', '/');
            }
            else
            if (txtEvaDate.Text != "")
            {
                DueDate = txtEvaDate.Text;
            }

            int Schedule_ID = 0;
            if (Request.QueryString["SchID"] != null)
            {
                Schedule_ID = UDFLib.ConvertToInteger(Request.QueryString["SchID"].ToString());
            }

            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("Criteria_ID", typeof(int)));
            dt.Columns.Add(new DataColumn("UserAnswer", typeof(int)));
            dt.Columns.Add(new DataColumn("TextAnswer", typeof(string)));
            dt.Columns.Add(new DataColumn("Remarks", typeof(string)));
            dt.Columns.Add(new DataColumn("NotApplicable", typeof(int)));

            int QustionAnswered = 0;
            foreach (GridViewRow row in GridView_AssignedCriteria.Rows)
            {
                QustionAnswered = 0;
                int    UserAnswer = 0;
                string TextAnswer = "";

                HiddenField hdnCriteria_ID = (HiddenField)row.FindControl("hdnCriteria_ID");
                int         Criteria_ID    = UDFLib.ConvertToInteger(hdnCriteria_ID.Value);

                RadioButtonList rdoOptions = (RadioButtonList)row.FindControl("rdoOptions");
                if (rdoOptions != null)
                {
                    UserAnswer = UDFLib.ConvertToInteger(rdoOptions.SelectedValue);
                }
                string Remarks = ((TextBox)(row.FindControl("txtRemarks"))).Text;
                ((TextBox)(row.FindControl("txtRemarks"))).BackColor = System.Drawing.Color.White;
                TextBox txtAns = (TextBox)row.FindControl("txtAnswer");
                if (txtAns != null)
                {
                    TextAnswer = txtAns.Text;
                }

                CheckBox chkNA = (CheckBox)row.FindControl("chkNA");

                if (chkNA.Checked == true)
                {
                    UserAnswer = 0;
                    TextAnswer = "";
                }
                if (chkNA.Checked == true || UserAnswer > 0 || TextAnswer.Length > 0)
                {
                    QustionAnswered = 1;
                }
                if (QustionAnswered == 0)
                {
                    QustionAnswered = -1;
                    break;
                }

                DataRow dr = dt.NewRow();
                dr[0] = Criteria_ID;
                dr[1] = UserAnswer;
                dr[2] = TextAnswer;
                dr[3] = Remarks;
                dr[4] = (chkNA.Checked == true ? 1 : 0);
                dt.Rows.Add(dr);
            }

            string js = "";
            if (QustionAnswered > 0)
            {
                int C_EID = BLL_Crew_Evaluation.INSERT_Crew_Evaluation(CrewID, EID, GetSessionUserID(), UDFLib.ConvertToDate(txtEvaDate.Text).ToShortDateString(), GetSessionUserID(), UDFLib.ConvertToDate(DueDate).ToShortDateString(), Schedule_ID);
                if (C_EID > 0)
                {
                    BLL_Crew_Evaluation.INSERT_Crew_Evaluation_Answer(C_EID, dt, GetSessionUserID());
                }
                js = "alert('Evaluation Saved');window.open('','_self','');window.close();";
                btnSaveEvaluation.Enabled = false;
            }
            else if (QustionAnswered == -1)
            {
                js = "alert('All evalution question are mandatory');chkNA_Checked();";
            }
            ScriptManager.RegisterStartupScript(this, this.GetType(), "status", js, true);
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#19
0
    protected void Load_CTM_Requests()
    {
        try
        {
            bool PendingWith       = false;
            int? PendingWithUserID = null;

            if (Boolean.TryParse(Convert.ToString(ViewState["PendingWithMe"]), out PendingWith))
            {
                if (PendingWith == true)
                {
                    PendingWithUserID = PendingWith ? UDFLib.ConvertIntegerToNull(Session["userid"]) : null;
                }
            }

            if (ViewState["CTM_STATUS"].ToString() == "SENTTOOFFICE")
            {
                if (Boolean.TryParse(Convert.ToString(ViewState["PendingWithMe"]), out PendingWith))
                {
                    PendingWithUserID = PendingWith ? UDFLib.ConvertIntegerToNull(Session["userid"]) : null;
                }
            }
            int       rowcount = ucCustomPagerItems.isCountRecord;
            DataTable dt       = BLL_PB_PortageBill.Get_CTM_Requests(ddlFleet.SelectedValues, ddlVessel.SelectedValues, txtFromDate.Text == "" ? "" : UDFLib.ConvertToDate(txtFromDate.Text, UDFLib.GetDateFormat()).ToShortDateString(), txtToDate.Text == "" ? "" : UDFLib.ConvertToDate(txtToDate.Text, UDFLib.GetDateFormat()).ToShortDateString()
                                                                     , UDFLib.ConvertStringToNull(ViewState["CTM_STATUS"]), UDFLib.ConvertStringToNull(txtSearch.Text), PendingWithUserID
                                                                     , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);
            gvCTMRequests.DataSource = dt;
            gvCTMRequests.DataBind();


            ucCustomPagerItems.CountTotalRec = rowcount.ToString();
            ucCustomPagerItems.BuildPager();


            if (ViewState["CTM_STATUS"].ToString() != "SENTTOOFFICE") //Pending with me
            {
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApproverName")].Visible = false;
            }
            else
            {
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApproverName")].Visible = true;
            }

            if (ViewState["CTM_STATUS"].ToString() == "APPROVED")
            {
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApprovedAmt")].Visible = false;
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApprovedOn")].Visible  = false;
            }
            else
            {
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApprovedAmt")].Visible = true;
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ApprovedOn")].Visible  = true;
            }

            if (ViewState["CTM_STATUS"].ToString() == "ACKVESSEL")
            {
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ReceivedAmt")].Visible  = true; //Received ON
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "DateReceived")].Visible = true; //Received Amount
            }
            else
            {
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "ReceivedAmt")].Visible  = false;
                gvCTMRequests.Columns[UDFLib.FindGridColumnIndex(gvCTMRequests.Columns, "DateReceived")].Visible = false;
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#20
0
    public void BindCrewHistoryGrid()
    {
        DateTime dtFrom = DateTime.Parse("1900/01/01");
        DateTime dtTo   = DateTime.Parse("2900/01/01");


        if (txtSearchJoinFromDate.Text != "")
        {
            dtFrom = UDFLib.ConvertToDate(Convert.ToString(txtSearchJoinFromDate.Text), UDFLib.GetDateFormat());
        }

        if (txtSearchJoinToDate.Text != "")
        {
            dtTo = UDFLib.ConvertToDate(Convert.ToString(txtSearchJoinToDate.Text), UDFLib.GetDateFormat());
        }

        int PAGE_SIZE  = ucCustomPager_CrewList.PageSize;
        int PAGE_INDEX = ucCustomPager_CrewList.CurrentPageIndex;

        int PAGE_SIZE1  = ucCustomPager1.PageSize;
        int PAGE_INDEX1 = ucCustomPager1.CurrentPageIndex;

        int SelectRecordCount  = ucCustomPager_CrewList.isCountRecord;
        int SelectRecordCount1 = ucCustomPager1.isCountRecord;

        DataSet ds = BLL_Crew_CrewList.Get_Crewlist_History(Convert.ToInt32(DDLVessel.SelectedValue), UDFLib.ConvertToInteger(ddlCountry.SelectedValue.ToString()), UDFLib.ConvertToInteger(ddlRank.SelectedValue.ToString()),
                                                            dtFrom, dtTo, PAGE_SIZE, PAGE_INDEX, PAGE_SIZE1, PAGE_INDEX1, ref SelectRecordCount, ref SelectRecordCount1);

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

        if (ucCustomPager_CrewList.isCountRecord == 1)
        {
            ucCustomPager_CrewList.CountTotalRec = SelectRecordCount.ToString();
            ucCustomPager_CrewList.BuildPager();
        }


        if (ucCustomPager1.isCountRecord == 1)
        {
            ucCustomPager1.CountTotalRec = SelectRecordCount.ToString();
            ucCustomPager1.BuildPager();
        }

        ds.Relations.Add(new DataRelation("NestedCat", ds.Tables[1].Columns["rank_category"], ds.Tables[2].Columns["rank_category"]));
        ds.Tables[2].TableName = "Members";

        rpt1.DataSource = ds.Tables[1];
        rpt1.DataBind();

        if (ucCustomPager_CrewList.isCountRecord == 1)
        {
            ucCustomPager_CrewList.CountTotalRec = SelectRecordCount.ToString();
            ucCustomPager_CrewList.BuildPager();
        }

        if (ucCustomPager1.isCountRecord == 1)
        {
            ucCustomPager1.CountTotalRec = SelectRecordCount1.ToString();
            ucCustomPager1.BuildPager();
        }
    }
示例#21
0
    protected void btnSaveVoyage_Click(object sender, EventArgs e)
    {
        string Message = "";
        string Joining_Date = "";
        int    Joining_Rank = 0, CurrentRankId = 0, CurrentRankScaleId = 0;
        int    Vessel_ID    = 0;
        string COCDate      = "";
        int    Joining_Port = 0;
        string Sign_On_Date = "";

        int Join_Type = UDFLib.ConvertToInteger(rdoOptions.SelectedValue);
        int CurrentVoyageID = UDFLib.ConvertToInteger(Request.QueryString["VoyID"]);
        int New_Voy_ID = 0, RankScaleId = 0;

        try
        {
            //Get Current voyage details
            DataTable dtVoy = objBLLCrew.Get_CrewVoyages(GetCrewID(), CurrentVoyageID);

            if (dtVoy.Rows.Count > 0)
            {
                Joining_Date       = dtVoy.Rows[0]["Joining_Date"].ToString();
                Joining_Rank       = UDFLib.ConvertToInteger(dtVoy.Rows[0]["Joining_Rank"].ToString());
                Vessel_ID          = UDFLib.ConvertToInteger(dtVoy.Rows[0]["Vessel_ID"].ToString());
                COCDate            = dtVoy.Rows[0]["COCDate"].ToString();
                Joining_Port       = UDFLib.ConvertToInteger(dtVoy.Rows[0]["Joining_Port"].ToString());
                Sign_On_Date       = dtVoy.Rows[0]["Sign_On_Date"].ToString();
                RankScaleId        = UDFLib.ConvertToInteger(dtVoy.Rows[0]["RankScaleId"].ToString());
                CurrentRankId      = Joining_Rank;
                CurrentRankScaleId = RankScaleId;
            }

            if (rdoOptions.SelectedValue == "1")
            {
                if (txtJoiningDate.Text.Trim() == "" || txtSignOnDate.Text.Trim() == "" || UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) == 0 ||
                    UDFLib.ConvertToInteger(ddlVessel.SelectedValue) == 0 || txtCOCDate.Text == "" || txtSignOffDate.Text == "" || UDFLib.ConvertToInteger(ctlSignOffPort.SelectedValue) == 0 ||
                    UDFLib.ConvertToInteger(ctlJoiningPort.SelectedValue) == 0 || UDFLib.ConvertToInteger(ddlContract.SelectedValue) == 0)
                {
                    Message = "Vessel Name,Contract Template, Joining Rank, Contract Date, Sign-On Date, Sign-Off-Date, Sign-Off-Port, Joining Port and EOC Date are mandatory fields. You might have missed one of the fields.";
                }
                else if (UDFLib.ConvertToDate(txtJoiningDate.Text) < UDFLib.ConvertDateToNull(COCDate))
                {
                    Message = "Contract date should be greater than the EOC of previous voyage";
                }
                else if (txtJoiningDate.Text.Trim() != "" && txtSignOnDate.Text != "" && UDFLib.ConvertToDate(txtJoiningDate.Text) > UDFLib.ConvertToDate(txtSignOnDate.Text))
                {
                    Message = "Sign-On Date can not be less than the Contract date";
                }
                else if (UDFLib.ConvertToDate(txtSignOffDate.Text) < DateTime.Today.AddDays(1))
                {
                    Message = "The transfer has to be planned atleast 1 day in advance";
                }
                else if (UDFLib.ConvertToDate(txtSignOffDate.Text) > UDFLib.ConvertToDate(txtSignOnDate.Text))
                {
                    Message = "The sign-off/sign-on dates are incorrect. Sign-off has to happen before the next sign-on";
                }
                else if (Vessel_ID == UDFLib.ConvertToInteger(ddlVessel.SelectedValue))
                {
                    Message = "Please select the new vessel different from the staff's current vessel.";
                }
                else
                {
                    Vessel_ID    = UDFLib.ConvertToInteger(ddlVessel.SelectedValue);
                    Joining_Rank = UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue);

                    New_Voy_ID = objBLLCrew.TransferCrew(CurrentVoyageID, GetCrewID(), Vessel_ID, Join_Type, Joining_Rank, UDFLib.ConvertToDate(txtJoiningDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtSignOnDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlJoiningPort.SelectedValue), UDFLib.ConvertToDate(txtCOCDate.Text).ToShortDateString(), GetSessionUserID(), UDFLib.ConvertToDate(txtSignOffDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlSignOffPort.SelectedValue), UDFLib.ConvertToInteger(ddlContract.SelectedValue));
                    if (New_Voy_ID > 0)
                    {
                        Message = "Crew transfer planned";
                        btnSaveVoyage.Enabled = false;
                    }
                    else
                    {
                        Message = "The transfer is already planned for the crew";
                    }
                }
            }
            if (rdoOptions.SelectedValue == "2")
            {
                if (txtJoiningDate.Text.Trim() == "" || txtSignOnDate.Text.Trim() == "" || UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) == 0 || txtCOCDate.Text == "" || UDFLib.ConvertToInteger(ddlContract.SelectedValue) == 0)
                {
                    Message = "Contract Template,Joining Rank, Contract Date, Sign-On Date and EOC Date are mandatory fields. You might have missed one of the fields.";
                }
                else if (Joining_Rank == UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) && RankScaleConsidered == 1 && RankScaleId == UDFLib.ConvertToInteger(ddlRankScale.SelectedValue))
                {
                    Message = "Promoted rank scale should not be the same as the current rank scale.";
                }
                else if (Joining_Rank == UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) && RankScaleConsidered == 0)
                {
                    Message = "Promoted rank should not be the same as the current rank.";
                }
                else if (UDFLib.ConvertDateToNull(txtJoiningDate.Text) < UDFLib.ConvertDateToNull(COCDate))
                {
                    Message = "Contract date should be greater than the EOC of previous voyage";
                }
                else if (txtJoiningDate.Text.Trim() != "" && txtSignOnDate.Text != "" && UDFLib.ConvertDateToNull(txtJoiningDate.Text) > UDFLib.ConvertDateToNull(txtSignOnDate.Text))
                {
                    Message = "Sign-On Date can not be less than the Contract date";
                }
                else if (UDFLib.ConvertDateToNull(txtSignOnDate.Text) < DateTime.Today.AddDays(1))
                {
                    Message = "The promotion has to be planned atleast 1 day in advance";
                }
                else
                {
                    Joining_Rank = UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue);

                    int NewWageContractId = 0;
                    if (hdWageContractId.Value != null && hdWageContractId.Value.ToString() != "")
                    {
                        NewWageContractId = int.Parse(hdWageContractId.Value.ToString());
                    }

                    New_Voy_ID = objBLLCrew.TransferCrew(CurrentVoyageID, GetCrewID(), Vessel_ID, Join_Type, Joining_Rank, UDFLib.ConvertToDate(txtJoiningDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtSignOnDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlJoiningPort.SelectedValue), UDFLib.ConvertToDate(txtCOCDate.Text).ToShortDateString(), GetSessionUserID(), "", 0, NewWageContractId, UDFLib.ConvertToInteger(ddlContract.SelectedValue));
                    if (New_Voy_ID > 0)
                    {
                        Message = "Staff promotion planned";

                        Message = Message + Save_Wages(GetCrewID(), New_Voy_ID, Vessel_ID);
                        btnSaveVoyage.Enabled = false;
                        if ((CurrentRankId != Joining_Rank) || (RankScaleConsidered == 1 && CurrentRankScaleId != UDFLib.ConvertToInteger(ddlRankScale.SelectedValue)))
                        {
                            //Save entry in Log for change in Wage Rank Scale
                            BLL_PortageBill.Ins_CrewChangeWageLog(CurrentRankId, UDFLib.ConvertToInteger(ddlRankScale.SelectedValue.ToString()), GetCrewID(), GetSessionUserID());
                        }
                    }
                    else
                    {
                        Message = "The transfer is already planned for the crew";
                    }
                }
            }
            if (rdoOptions.SelectedValue == "3")
            {
                if (UDFLib.ConvertToInteger(ddlVessel.SelectedValue) == 0 || txtJoiningDate.Text.Trim() == "" || txtSignOnDate.Text.Trim() == "" || UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) == 0 ||
                    txtCOCDate.Text == "" || txtSignOffDate.Text == "" || UDFLib.ConvertToInteger(ctlSignOffPort.SelectedValue) == 0 || UDFLib.ConvertToInteger(ddlContract.SelectedValue) == 0)
                {
                    Message = "Vessel Name,Contract Template, Joining Rank, Contract Date, Sign-On Date, Sign-Off-Date, Sign-Off-Port and EOC Date are mandatory fields. You might have missed one of the fields.";
                }
                else if (Joining_Rank == UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) && RankScaleConsidered == 1 && RankScaleId == UDFLib.ConvertToInteger(ddlRankScale.SelectedValue))
                {
                    Message = "Promoted rank scale should not be the same as the current rank scale.";
                }
                else if (Joining_Rank == UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) && RankScaleConsidered == 0)
                {
                    Message = "Promoted rank should not be the same as the current rank.";
                }
                else if (Vessel_ID == UDFLib.ConvertToInteger(ddlVessel.SelectedValue))
                {
                    Message = "Please select the new vessel different from the staff's current vessel.";
                }

                else if (UDFLib.ConvertDateToNull(txtJoiningDate.Text) < UDFLib.ConvertDateToNull(COCDate))
                {
                    Message = "Contract date should be greater than the EOC of previous voyage";
                }
                else if (txtJoiningDate.Text.Trim() != "" && txtSignOnDate.Text != "" && UDFLib.ConvertDateToNull(txtJoiningDate.Text) > UDFLib.ConvertDateToNull(txtSignOnDate.Text))
                {
                    Message = "Sign-On Date can not be less than the Contract date";
                }
                else if (UDFLib.ConvertDateToNull(txtSignOffDate.Text) < DateTime.Today.AddDays(1))
                {
                    Message = "The transfer has to be planned atleast 1 day in advance";
                }
                else if (UDFLib.ConvertDateToNull(txtSignOffDate.Text) > UDFLib.ConvertDateToNull(txtSignOnDate.Text))
                {
                    Message = "The sign-off/sign-on dates are incorrect. Sign-off has to happen before the next sign-on";
                }
                else
                {
                    Vessel_ID    = UDFLib.ConvertToInteger(ddlVessel.SelectedValue);
                    Joining_Rank = UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue);
                    New_Voy_ID   = objBLLCrew.TransferCrew(CurrentVoyageID, GetCrewID(), Vessel_ID, Join_Type, Joining_Rank, UDFLib.ConvertToDate(txtJoiningDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtSignOnDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlJoiningPort.SelectedValue), UDFLib.ConvertToDate(txtCOCDate.Text).ToShortDateString(), GetSessionUserID(), UDFLib.ConvertToDate(txtSignOffDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlSignOffPort.SelectedValue), UDFLib.ConvertToInteger(ddlContract.SelectedValue));


                    if (New_Voy_ID > 0)
                    {
                        Message = "Staff transfer promotion planned";
                        Message = Message + Save_Wages(GetCrewID(), New_Voy_ID, Vessel_ID);
                        btnSaveVoyage.Enabled = false;
                        if ((CurrentRankId != Joining_Rank) || (RankScaleConsidered == 1))
                        {
                            //Save entry in Log for change in Wage Rank Scale
                            if (RankScaleConsidered == 1 && CurrentRankScaleId != UDFLib.ConvertToInteger(ddlRankScale.SelectedValue))
                            {
                                BLL_PortageBill.Ins_CrewChangeWageLog(CurrentRankId, UDFLib.ConvertToInteger(ddlRankScale.SelectedValue.ToString()), GetCrewID(), GetSessionUserID());
                            }
                            else
                            {
                                BLL_PortageBill.Ins_CrewChangeWageLog(CurrentRankId, 0, GetCrewID(), GetSessionUserID());
                            }
                        }
                    }
                    else
                    {
                        Message = "The transfer is already planned for the crew";
                    }
                }
            }

            if (New_Voy_ID > 0)
            {
                int       VoyID = UDFLib.ConvertToInteger(Request.QueryString["VoyID"]);
                DataTable dt    = objBLLCrew.Get_Transfer_Promotions(GetCrewID(), VoyID, GetSessionUserID());
                GridView1.DataSource = dt;
                GridView1.DataBind();
                pnlViewTransfer.Visible = true;
                pnlTransfer.Visible     = false;
                pnlPromotion.Visible    = false;
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
        if (Message.Length > 0)
        {
            lblMessage.Text = Message;
        }
    }
示例#22
0
 /// <summary>
 /// Open the Inspection List based on Certificate Inspection /Renewable Inspection icon
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSearchInspection_Click(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = objInsp.Get_Current_Schedules(ddlStatus.SelectedValue, VesselId, txtInspectionFromDate.Text == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtInspectionFromDate.Text)), txtInspectionToDate.Text == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtInspectionToDate.Text)), Convert.ToInt16(DDLPort.SelectedValue));
         if (ds.Tables.Count > 0)
         {
             gvInspectionSchedule.DataSource = ds.Tables[0];
             gvInspectionSchedule.DataBind();
         }
         else
         {
             gvInspectionSchedule.DataSource = null;
             gvInspectionSchedule.DataBind();
         }
     }
     catch (Exception ex)
     {
         UDFLib.WriteExceptionLog(ex);
     }
 }
示例#23
0
    public void BindIndex()
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataTable dt = BLL_PB_PhoneCard.PhoneCord_Request_Search(txtCardNumber.Text != "" ? txtCardNumber.Text : null, (DataTable)Session["sVesselCode"], UDFLib.ConvertToDate(txtFromDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtToDate.Text).ToShortDateString(), ddlStatus.SelectedIndex == 0 ? null : ddlStatus.SelectedValue, sortbycoloumn, sortdirection
                                                                     , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);
            if (ucCustomPagerItems.isCountRecord == 1)
            {
                ucCustomPagerItems.CountTotalRec = rowcount.ToString();
                ucCustomPagerItems.BuildPager();
            }

            gvPhoneCardRequest.DataSource = dt;
            gvPhoneCardRequest.DataBind();
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#24
0
    protected void ImgExpExcel_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataTable dt = BLL_PB_PhoneCard.PhoneCord_Request_Export(txtCardNumber.Text != "" ? txtCardNumber.Text : null, (DataTable)Session["sVesselCode"], UDFLib.ConvertToDate(txtFromDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtToDate.Text).ToShortDateString(), ddlStatus.SelectedIndex == 0 ? null : ddlStatus.SelectedValue);

            UDFLib.ChangeColumnDataType(dt, "DATE_OF_CREATION", typeof(string));
            UDFLib.ChangeColumnDataType(dt, "PBILL_DATE", typeof(string));

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["DATE_OF_CREATION"] = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["DATE_OF_CREATION"]));
                dt.Rows[i]["PBILL_DATE"]       = "&nbsp;" + UDFLib.ConvertUserDateFormat(Convert.ToString(dt.Rows[i]["PBILL_DATE"]));
            }

            string[] HeaderCaptions  = { "Request Number", "Vessel Name", "Status", "Request Date", "Total Cards", "Bill Date" };
            string[] DataColumnsName = { "REQUEST_NUMBER", "VESSEL_NAME", "REQUEST_STATUS", "DATE_OF_CREATION", "TOTAL_REQUEST", "PBILL_DATE" };

            GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "PhoneCardRequest", "Request List");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#25
0
    protected void btnSaveDetails_Click(object s, EventArgs e)
    {
        try
        {
            int Vsl_ID = 0;
            if (UDFLib.ConvertToInteger(hdfWelfare_ID.Value) == 0)
            {
                Vsl_ID = Convert.ToInt32(ddlVesselUpd.SelectedValue);
            }

            BLL_PB_PortageBill.UPD_Lib_Crew_Welfare(UDFLib.ConvertToInteger(hdfWelfare_ID.Value), UDFLib.ConvertToDecimal(txtWelfareAmount.Text), Vsl_ID, UDFLib.ConvertToDate(txtEffectiveDate.Text, UDFLib.GetDateFormat()), Convert.ToInt32(Session["userid"]));
            BindItems();

            ScriptManager.RegisterStartupScript(this, this.GetType(), "close", "hideModal('dvWelfare')", true);
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "MMCD", "showModal('dvWelfare')", true);
            UDFLib.WriteExceptionLog(ex);
        }
    }
    protected void btnFinalize_Click(object sender, EventArgs e)
    {
        if (ISvalid())
        {
            DataTable dt = new DataTable();
            dt.Clear();
            dt.Columns.Add("ITEM_REF_CODE");
            dt.Columns.Add("ORDER_PRICE");
            dt.Columns.Add("ORDER_DISCOUNT");
            dt.Columns.Add("ORDER_RATE");
            dt.Columns.Add("REQUESTED_QTY");
            dt.Columns.Add("VAT");
            dt.Columns.Add("WithHold");

            for (int i = 0; i < rptMain.Items.Count; i++)
            {
                Repeater rptChild = (Repeater)rptMain.Items[i].FindControl("rptChild");
                for (int j = 0; j < rptChild.Items.Count; j++)
                {
                    TextBox      txtPPU         = (TextBox)rptChild.Items[j].FindControl("txt_PPU");
                    TextBox      txtTP          = (TextBox)rptChild.Items[j].FindControl("txtTP");
                    TextBox      txtDiscount    = (TextBox)rptChild.Items[j].FindControl("txt_Discount");
                    TextBox      txtQnty        = (TextBox)rptChild.Items[j].FindControl("txtQnty");
                    ImageButton  btn            = (ImageButton)rptChild.Items[j].FindControl("btnupdate");
                    DropDownList ddlItemvat     = (DropDownList)rptChild.Items[j].FindControl("ddl_ItemVAT");
                    DropDownList ddlItemWithhod = (DropDownList)rptChild.Items[j].FindControl("ddl_item_Withhold");
                    DataRow      dr             = dt.NewRow();
                    dr["ITEM_REF_CODE"]  = btn.CommandArgument.ToString();
                    dr["ORDER_PRICE"]    = Convert.ToDecimal(txtPPU.Text.Length == 0 ? "0" : txtTP.Text);
                    dr["ORDER_DISCOUNT"] = Convert.ToDecimal(txtDiscount.Text.Length == 0 ? "0" : txtDiscount.Text);
                    dr["ORDER_RATE"]     = Convert.ToDecimal(txtPPU.Text.Length == 0 ? "0" : txtPPU.Text);
                    dr["REQUESTED_QTY"]  = Convert.ToDecimal(txtPPU.Text.Length == 0 ? "0" : txtQnty.Text);
                    dr["VAT"]            = Convert.ToDecimal(Convert.ToDecimal(ddlItemvat.SelectedValue) == 0 ? "0" : ddlItemvat.SelectedValue);
                    dr["WithHold"]       = Convert.ToDecimal(Convert.ToDecimal(ddlItemWithhod.SelectedValue) == 0 ? "0" : ddlItemWithhod.SelectedValue);

                    dt.Rows.Add(dr);
                }
            }
            //string DateFormat = UDFLib.GetDateFormat();//Get User date format
            //UDFLib.ConvertUserDateFormat(txtDeliveryDate.Text, DateFormat);



            string           ReturnReq = string.Empty;
            IventoryItemData ItemData  = new IventoryItemData();
            ItemData.DocumentCode  = DocCode;
            ItemData.Delivery_Date = UDFLib.ConvertToDate(txt_SuppDate.Text);;
            ItemData.Delivery_Port = Convert.ToInt32(ddlSupp_Port.SelectedValue);
            ItemData.Discount      = Convert.ToInt32(txt_Discount.Text);
            ItemData.SupplierID    = HD_SelectedSupplier.Value.ToString();
            ItemData.WithHoldTax   = ddlWithHoldTax.SelectedValue.ToString();
            ItemData.VAT           = ddlVAt.SelectedValue.ToString();
            ItemData.Advance       = Convert.ToInt32(txt_Advance.Text);
            ItemData.Currency      = Session["CurrencyCode"].ToString();
            if (ValidateQuestions() == true)
            {
                using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase())
                {
                    objTechService.SaveUpdate_Quotation(ItemData, Convert.ToInt32(Session["userid"]), Convert.ToDecimal(HD_TP.Value.Length < 1 ? "0" : HD_TP.Value), dt);
                }

                using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase())
                {
                    ReturnReq = objTechService.SaveUpdate_FinalQuotation(ItemData, Convert.ToInt32(Session["userid"]));
                }
                SaveQuestionnaire(ReturnReq);
                ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Requisition has been Finalized.\\n Please Note Requisition Number:" + ReturnReq + "');window.location='PendingRequisitionDetails.aspx?NOQUOTE=1';", true);
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Please complete the Purchase Questionnaire to proceed with the purchase process');", true);
                BindItmPreviewRpt();
            }
        }
        else
        {
            string msgtxt = string.Empty;
            if (HD_SelectedSupplier.Value.ToString() == string.Empty)
            {
                msgtxt = "Please Select The Supplier";
            }
            else
            {
                msgtxt = "Please Fill all the Mandatory Fields";
            }
            String msg = String.Format("alert('" + msgtxt + "'); ");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
        }
    }
示例#27
0
    /// <summary>
    /// Bind all records of observation index
    /// </summary>
    public void Bind_ObservationIndex()
    {
        try
        {
            BLL_VET_Index objBLLIndx    = new BLL_VET_Index();
            DataSet       ds            = new DataSet();
            int           rowcount      = ucCustomPagerItemsObs.isCountRecord;
            string        sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?          sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            DataTable dtInspector = new DataTable();
            dtInspector.Columns.Add("ID");
            DataTable dtEXInspector = new DataTable();
            dtEXInspector.Columns.Add("ID");

            foreach (DataRow dr in DDLInspectorObs.SelectedValues.Rows)
            {
                if (dr[0].ToString().Split('_')[1] == "In")
                {
                    dtInspector.Rows.Add(dr[0].ToString().Split('_')[0]);
                }
                if (dr[0].ToString().Split('_')[1] == "Ex")
                {
                    dtEXInspector.Rows.Add(dr[0].ToString().Split('_')[0]);
                }
            }

            DateTime?LObsFromDate, LObsToDate;
            LObsFromDate = txtLObsFromDate.Text.Trim() == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtLObsFromDate.Text));
            LObsToDate   = txtLObsToDate.Text.Trim() == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtLObsToDate.Text));
            ds           = objBLLIndx.VET_Get_ObservationIndex(DDLQuestionnaire.SelectedValues, DDLSection.SelectedValues, DDLQuestion.SelectedValues, UDFLib.ConvertToInteger(rbtnType.SelectedValue), ViewState["Status"].ToString(), UDFLib.ConvertToInteger(DDLFleet.SelectedValue), DDLVesselObs.SelectedValues, DDLOilMajorObs.SelectedValues, dtInspector, dtEXInspector, DDLCategories.SelectedValues, DDLRiskLevel.SelectedValues, txtObservationVessel.Text != "" ? txtObservationVessel.Text.Trim() : null, LObsFromDate, LObsToDate, sortbycoloumn, sortdirection, ucCustomPagerItemsObs.CurrentPageIndex, ucCustomPagerItemsObs.PageSize, ref rowcount);

            if (ds.Tables.Count > 0)
            {
                ViewState["dtObsResponse"]    = ds.Tables[1];
                ViewState["dtObsJobsCount"]   = ds.Tables[2];
                ViewState["dtObsvationCount"] = ds.Tables[3];
            }

            if (ucCustomPagerItemsObs.isCountRecord == 1)
            {
                ucCustomPagerItemsObs.CountTotalRec = rowcount.ToString();
                ucCustomPagerItemsObs.BuildPager();
            }
            gvObservationIndex.DataSource = ds.Tables[0];
            gvObservationIndex.DataBind();
            if (ds.Tables[0].Rows.Count > 0)
            {
                btnObsExport.Enabled = true;
            }
            else
            {
                btnObsExport.Enabled = false;
            }

            UpdPnlGridObs.Update();
            UpdPnlFilterObs.Update();
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
    /// <summary>
    /// Fill the grid with Unassigned Crews according to filter
    /// </summary>
    protected void Search_UnAssigned()
    {
        try
        {
            int    PAGE_SIZE           = ucCustomPager_UnAssignedCrew.PageSize;
            int    PAGE_INDEX          = ucCustomPager_UnAssignedCrew.CurrentPageIndex;
            int    SelectRecordCount   = ucCustomPager_UnAssignedCrew.isCountRecord;
            int    VesselId_OffSignner = int.Parse(ddlVessel_UA.SelectedValue.ToString());
            string sortbycoloumn       = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection       = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            //selected Vessel Type
            int       i             = 1;
            DataTable dtVesselTypes = new DataTable();
            dtVesselTypes.Columns.Add("PID");
            dtVesselTypes.Columns.Add("VALUE");

            foreach (DataRow dr in ddlVesselType.SelectedValues.Rows)
            {
                DataRow dr1 = dtVesselTypes.NewRow();
                dr1["PID"]   = i;
                dr1["VALUE"] = dr[0];
                dtVesselTypes.Rows.Add(dr1);
                i++;
            }

            DataTable dt = BLL_Crew_CrewList.Get_UnAssigned_CrewList(int.Parse(ddlManningOffice.SelectedValue), int.Parse(ddlNationality.SelectedValue), int.Parse(ddlRank_UA.SelectedValue), txtFromDt_UA.Text.Trim() == "" ? "" : UDFLib.ConvertToDate(txtFromDt_UA.Text).ToShortDateString(), txtToDt_UA.Text.Trim() == "" ? "" : UDFLib.ConvertToDate(txtToDt_UA.Text).ToShortDateString(), txtFreeText_UA.Text, int.Parse(ddlVessel_UA.SelectedValue), VesselId_OffSignner, int.Parse(UA_AvailableOptions.SelectedValue), GetSessionUserID(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, sortbycoloumn, sortdirection, int.Parse(ddlMinYearOperator.SelectedValue), int.Parse(ddlMinYearsRank.SelectedValue), int.Parse(ddlMinYearsAllTankers.SelectedValue), dtVesselTypes);

            if (ucCustomPager_UnAssignedCrew.isCountRecord == 1)
            {
                ucCustomPager_UnAssignedCrew.CountTotalRec = SelectRecordCount.ToString();
                ucCustomPager_UnAssignedCrew.BuildPager();
            }

            gvUnAssignedCrew.DataSource = dt;
            gvUnAssignedCrew.DataBind();
            ScriptManager.RegisterStartupScript(this, this.GetType(), "SaveAddError", "BindHeight();", true);
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
示例#29
0
    /// <summary>
    /// Description: If by voyage is selected , for all vessels voyage ddl wil populate based on search date
    /// </summary>

    protected void ddlVoyage_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            DateTime Startdate;
            Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
            //Startdate= Convert.ToDateTime(txtStartDate.Text);
            DateTime EndDate;
            EndDate = Convert.ToDateTime(UDFLib.ConvertToDate(txtEndDate.Text));
            //EndDate = Convert.ToDateTime(txtEndDate.Text);
            int          KPI_ID    = 1;
            DropDownList ddlVoyage = (DropDownList)sender;
            GridDataItem item      = (GridDataItem)ddlVoyage.NamingContainer;
            Label        avg       = (Label)item.FindControl("Vessel_Average");
            HiddenField  hdf       = (HiddenField)item.FindControl("hdVesselID");
            LinkButton   lnkVessel = (LinkButton)item.FindControl("Item_Name");

            item["Average"].BackColor = System.Drawing.Color.White;
            avg.Text = "0";
            if (ddlVoyage.SelectedIndex != 0)
            {
                string    val = ddlVoyage.SelectedValue.Trim().Split(':')[0] + ":" + ddlVoyage.SelectedValue.Trim().Split(':')[1];
                DataTable dtq = BLL_TMSA_PI.GetTelDate(val.Trim(), Convert.ToInt32(hdf.Value)).Tables[0];

                if (dtq.Rows[0][0].ToString() != "")
                {
                    Startdate = Convert.ToDateTime(dtq.Rows[0][1].ToString());

                    // hiddenVesselStartDate.Value = dtq.Rows[0][0].ToString();
                    // hiddenStartDate.Text = dtq.Rows[0][0].ToString();
                    hiddenStartDate.Value = Startdate.ToString("dd-MM-yyyy");
                }
                if (dtq.Rows[dtq.Rows.Count - 1][0].ToString() != "")
                {
                    EndDate = Convert.ToDateTime(dtq.Rows[dtq.Rows.Count - 1][1].ToString());
                    //hiddenVesselEndDate.Value = dtq.Rows[dtq.Rows.Count - 1][0].ToString();
                    //hiddenEndDate.Text = dtq.Rows[dtq.Rows.Count - 1][0].ToString();
                    hiddenEndDate.Value = EndDate.ToString("dd-MM-yyyy");
                }
            }

            DataTable dt = BLL_TMSA_PI.GetVoyageData(ddlVoyage.SelectedValue.Trim(), Convert.ToInt32(hdf.Value), KPI_ID).Tables[0];
            if (dt.Rows.Count > 0)
            {
                avg.Text = Math.Round(Convert.ToDouble(dt.Rows[0]["Value"].ToString()), 2).ToString();
                if (Convert.ToDouble(avg.Text) == 0)
                {
                    lnkVessel.Enabled        = false;
                    item["Vessel"].BackColor = System.Drawing.Color.White;
                }
                else
                {
                    lnkVessel.Enabled = true;
                }
            }
            else
            {
                lnkVessel.Enabled        = false;
                item["Vessel"].BackColor = System.Drawing.Color.White;
            }

            Label Vessel_Goal = (Label)item.FindControl("Vessel_Goal");
            Label eedi        = (Label)item.FindControl("eedi");

            if (Convert.ToDouble(avg.Text) > 0 && Convert.ToDouble(eedi.Text) > 0)
            {
                if ((Convert.ToDouble(avg.Text) < Convert.ToDouble(Vessel_Goal.Text)))
                {
                    item["Average"].BackColor = System.Drawing.Color.White;
                }
                if (Convert.ToDouble(avg.Text) > Convert.ToDouble(eedi.Text))
                {
                    item["Average"].BackColor = System.Drawing.ColorTranslator.FromHtml("#FFC7CE");
                }
                else if ((Convert.ToDouble(avg.Text) > Convert.ToDouble(Vessel_Goal.Text)) && (Convert.ToDouble(avg.Text) < Convert.ToDouble(eedi.Text)))
                {
                    item["Average"].BackColor = System.Drawing.ColorTranslator.FromHtml("#FABF8F");
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    /// <summary>
    /// Fill all the Items Detail in Datatable and sets the "IventoryItemData" properties .
    /// saves the Requisition
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)                                             // Save Requisition
    {
        if (ISvalid())
        {
            DataTable dt = new DataTable();
            dt.Clear();
            dt.Columns.Add("ITEM_REF_CODE");
            dt.Columns.Add("ORDER_PRICE");
            dt.Columns.Add("ORDER_DISCOUNT");
            dt.Columns.Add("ORDER_RATE");
            dt.Columns.Add("REQUESTED_QTY");
            dt.Columns.Add("VAT");
            dt.Columns.Add("WithHold");

            for (int i = 0; i < rptMain.Items.Count; i++)
            {
                Repeater rptChild = (Repeater)rptMain.Items[i].FindControl("rptChild");
                for (int j = 0; j < rptChild.Items.Count; j++)
                {
                    TextBox      txtPPU         = (TextBox)rptChild.Items[j].FindControl("txt_PPU");
                    TextBox      txtTP          = (TextBox)rptChild.Items[j].FindControl("txtTP");
                    TextBox      txtDiscount    = (TextBox)rptChild.Items[j].FindControl("txt_Discount");
                    TextBox      txtQnty        = (TextBox)rptChild.Items[j].FindControl("txtQnty");
                    ImageButton  btn            = (ImageButton)rptChild.Items[j].FindControl("btnupdate");
                    DropDownList ddlItemvat     = (DropDownList)rptChild.Items[j].FindControl("ddl_ItemVAT");
                    DropDownList ddlItemWithhod = (DropDownList)rptChild.Items[j].FindControl("ddl_item_Withhold");
                    DataRow      dr             = dt.NewRow();
                    dr["ITEM_REF_CODE"]  = btn.CommandArgument.ToString();
                    dr["ORDER_PRICE"]    = Convert.ToDecimal(txtPPU.Text.Length == 0 ? "0" : txtTP.Text);
                    dr["ORDER_DISCOUNT"] = Convert.ToDecimal(txtDiscount.Text.Length == 0 ? "0" : txtDiscount.Text);
                    dr["ORDER_RATE"]     = Convert.ToDecimal(txtPPU.Text.Length == 0 ? "0" : txtPPU.Text);
                    dr["REQUESTED_QTY"]  = Convert.ToDecimal(txtPPU.Text.Length == 0 ? "0" : txtQnty.Text);
                    dr["VAT"]            = Convert.ToDecimal(Convert.ToDecimal(ddlItemvat.SelectedValue) == 0 ? "0" : ddlItemvat.SelectedValue);
                    dr["WithHold"]       = Convert.ToDecimal(Convert.ToDecimal(ddlItemWithhod.SelectedValue) == 0 ? "0" : ddlItemWithhod.SelectedValue);

                    dt.Rows.Add(dr);
                }
            }

            IventoryItemData ItemData = new IventoryItemData();
            ItemData.DocumentCode    = Session["DocumentCode"].ToString();
            ItemData.RequisitionCode = Session["Requisitioncode"].ToString();
            ItemData.Delivery_Port   = Convert.ToInt32(ddlSupp_Port.SelectedValue);
            ItemData.Discount        = Convert.ToInt32(txt_Discount.Text);
            ItemData.SupplierID      = HD_SelectedSupplier.Value.ToString();
            ItemData.WithHoldTax     = ddlWithHoldTax.SelectedValue.ToString();
            ItemData.VAT             = ddlVAt.SelectedValue.ToString();
            ItemData.Advance         = Convert.ToInt32(txt_Advance.Text);
            ItemData.Currency        = Session["CurrencyCode"].ToString();
            ItemData.Delivery_Date   = UDFLib.ConvertToDate(txt_SuppDate.Text);

            //bindprice(Convert.ToDecimal(Session["PreviousCurr"]));
            using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase())
            {
                objTechService.SaveUpdate_Quotation(ItemData, Convert.ToInt32(Session["userid"]), Convert.ToDecimal(HD_TP.Value.Length < 1 ? "0" : HD_TP.Value), dt);
            }

            String msg = String.Format("alert('Requisition has been Saved sucessfully.'); ");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
        }
        else
        {
            string msgtxt = string.Empty;
            if (HD_SelectedSupplier.Value.ToString() == string.Empty)
            {
                msgtxt = "Please Select The Supplier";
            }
            else
            {
                msgtxt = "Please Fill all the Mandatory Fields";
            }
            String msg = String.Format("alert('" + msgtxt + "'); ");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
        }
    }