protected int SaveLPODetails()
    {
        DataTable dtGridItems = new DataTable();

        dtGridItems.Columns.Add("PID");
        dtGridItems.Columns.Add("Item_ID");
        dtGridItems.Columns.Add("item");
        dtGridItems.Columns.Add("amount");
        dtGridItems.Columns.Add("remark");
        dtGridItems.Columns.Add("vessel_id");

        dtGridItems.PrimaryKey = new DataColumn[] { dtGridItems.Columns["PID"] };

        DataRow dr    = null;
        int     RowID = 1;

        foreach (GridViewRow grItem in gvItemList.Rows)
        {
            dr              = dtGridItems.NewRow();
            dr["PID"]       = RowID++;
            dr["Item_ID"]   = ((HiddenField)grItem.FindControl("hdfID")).Value;
            dr["item"]      = ((TextBox)grItem.FindControl("txtItem")).Text;
            dr["amount"]    = UDFLib.ConvertToDecimal(((TextBox)grItem.FindControl("txtAmount")).Text);
            dr["remark"]    = ((TextBox)grItem.FindControl("txtRemark")).Text;
            dr["vessel_id"] = (grItem.FindControl("ddlpovessels") as DropDownList).SelectedValue;

            //if (dtGridItems.Rows.Contains(dr["vessel_id"].ToString()) || dr["vessel_id"].ToString() == "0")
            //{
            //    lblMessage.Visible = true;
            //    lblMessage.Text = "Same vessel can not be selected more than one time . Please select different vessel for each row.";
            //    return 0;
            //}
            if (dr["item"].ToString().Trim() == "")
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "Please enter item details .";
                return(0);
            }
            if (Convert.ToDecimal(dr["amount"].ToString()) < 1)
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "Amount should be greater than zero !";
                return(0);
            }

            dtGridItems.Rows.Add(dr);
        }

        return(BLL_PURC_LOG.Ins_Log_LogisticPO_Details(UDFLib.ConvertToInteger(Request.QueryString["LOG_ID"]), DDLCurrency.SelectedItem.Text, rbtnlistPOType.SelectedValue,
                                                       rbtnlistCostType.SelectedValue, ddlHub.SelectedValue, ddlAgentFord.SelectedValue, UDFLib.ConvertToInteger(ctlPortList1.SelectedValue), "", dtGridItems, Convert.ToInt32(Session["USERID"].ToString()), uc_SupplierList1.SelectedValue));
    }
Exemple #2
0
    /// <summary>
    /// To save attached files to DB.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="file"></param>
    protected void AjaxFileUpload1_OnUploadComplete(object sender, AjaxFileUploadEventArgs file)
    {
        try
        {
            Byte[] fileBytes = file.GetContents();
            string sPath     = Server.MapPath("\\" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "\\uploads\\Technical");
            string sPath1    = Server.MapPath("\\" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "\\uploads\\Inspection");
            Guid   GUID      = Guid.NewGuid();

            string Flag_Attach = GUID.ToString() + Path.GetExtension(file.FileName);

            int    Office_ID   = Convert.ToInt32(Request.QueryString["OFFID"]);
            int    Worklist_ID = Convert.ToInt32(Request.QueryString["WLID"]);
            int    Vessel_ID   = Convert.ToInt32(Request.QueryString["VID"]);
            string _fileName   = "";

            int FileID = objBLL.Insert_Worklist_Attachment(Vessel_ID, Worklist_ID, Office_ID, UDFLib.Remove_Special_Characters(file.FileName), Flag_Attach, file.FileSize,
                                                           UDFLib.ConvertToInteger(Session["USERID"]));

            _fileName = "TEC_" + Vessel_ID + "_" + Worklist_ID + "_" + Office_ID + "_" + "O" + "_" + FileID.ToString() + "_" + Flag_Attach;

            // This method insert attachments in object table and it will sync to mobile by Pranav Sakpal on 2016-03-23
            int Ret = objBLL.Insert_ActivityObject(Vessel_ID, Worklist_ID, Office_ID, _fileName, _fileName, UDFLib.ConvertToInteger(Session["USERID"]));


            string FullFilename = Path.Combine(sPath, _fileName);

            //Save attached file to folder
            FileStream fileStream = new FileStream(FullFilename, FileMode.Create, FileAccess.ReadWrite);
            fileStream.Write(fileBytes, 0, fileBytes.Length);
            fileStream.Close();

            // This will copy attachments in inspection folder it will sync to mobile by Pranav Sakpal on 2016-03-23
            string filecopyname = _fileName;
            File.Copy(FullFilename, Path.Combine(sPath1, filecopyname), true);


            Load_Attachments(Vessel_ID, Worklist_ID, Office_ID, GetSessionUserID());
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    protected void btnSaveRRemark_Click(object sender, EventArgs e)
    {
        int   RowIndex       = UDFLib.ConvertToInteger(ViewState["ReworkRowIndex"].ToString());
        Label lblFileID      = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblFileID");
        Label lblStatusID    = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblStatusID");
        Label lblOfficeID    = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblOfficeID");
        Label lblVesselID    = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblVesselID");
        int   Approval_Level = UDFLib.ConvertToInteger(grdApprovalList.DataKeys[RowIndex].Values["Approval_Level"]);
        Label lblVersion     = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblVersion");

        objFMS.FMS_Update_ScheduleStatusForRework(GetSessionUserID(), UDFLib.ConvertToInteger(lblStatusID.Text), UDFLib.ConvertToInteger(lblOfficeID.Text), UDFLib.ConvertToInteger(lblVesselID.Text), txtRRemark.Text, UDFLib.ConvertToInteger(lblVersion.Text), Approval_Level, UDFLib.ConvertToInteger(lblFileID.Text));

        string js = " alert('Form Re-work Successfully');";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
        string js1 = " hideModal('dvReworkRemark');";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "hdModal", js1, true);
        txtRRemark.Text = "";
        BindGrid();
    }
Exemple #4
0
    protected void gvDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int Details_ID = UDFLib.ConvertToInteger(gvDetails.DataKeys[e.RowIndex].Values[1].ToString());

        ViewState["ScreenID"] = UDFLib.ConvertToInteger(gvDetails.DataKeys[e.RowIndex].Values[0].ToString());
        int result = BLL_Infra_ShipSettings.Delete_RANK_SCREEN_Access_Details(Details_ID, UDFLib.ConvertToInteger(Session["UserID"].ToString()));

        BindScreen_By_SrceenID();
        upDetails.Update();
    }
Exemple #5
0
    /// <summary>
    /// Load all data to respective controls ,when user View job.
    /// </summary>
    /// <param name="drWorklistDetails"> Data row of unique key combination of Vessel ID, Office Id and Worklist ID.</param>
    protected void fillvalue(DataRow drWorklistDetails)
    {
        try
        {
            if (drWorklistDetails != null)
            {
                int _OfficeID  = Convert.ToInt32(drWorklistDetails["office_id"]);
                int WorklistID = Convert.ToInt32(drWorklistDetails["worklist_id"]);
                int VesselID   = Convert.ToInt32(drWorklistDetails["vessel_id"]);
                txtFollowupDate.Text = DateTime.Today.ToString("dd/MM/yyyy");


                DataSet dtsJobDetails = objBLL.Get_JobDetails_ByID(_OfficeID, WorklistID, VesselID);

                if (dtsJobDetails != null)
                {
                    hdnOfficeID.Value         = _OfficeID.ToString();
                    hdnVesselID.Value         = VesselID.ToString();
                    hdnWorklistlID.Value      = WorklistID.ToString();
                    Session["hdnOfficeID"]    = _OfficeID.ToString();
                    Session["hdnVesselIDl"]   = VesselID.ToString();
                    Session["hdnWorklistlID"] = WorklistID.ToString();

                    string temp = "";

                    hplCloseThisJob.Visible      = false;
                    hplRework.Visible            = false;
                    lblWorklistTitle.Text        = "";
                    txtWorklistStatusRemark.Text = "";

                    lblFunction.Text    = "";
                    lblFunction.Text    = dtsJobDetails.Tables[0].Rows[0]["Function_Text"].ToString();
                    lblLocation.Text    = "";
                    lblLocation.Text    = dtsJobDetails.Tables[0].Rows[0]["Location_Text"].ToString();
                    lblSubLocation.Text = "";
                    lblSubLocation.Text = dtsJobDetails.Tables[0].Rows[0]["Sub_Location_Text"].ToString();

                    hplCloseThisJob.Visible = false;

                    if (dtsJobDetails.Tables[0].Rows[0]["VERIFIED_BY"].ToString() == "")
                    {
                        if (dtsJobDetails.Tables[0].Rows[0]["WL_TYPE"].ToString() == "NCR" || (dtsJobDetails.Tables[0].Rows[0]["WL_TYPE"].ToString() != "NCR" && dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString() != "") || (dtsJobDetails.Tables[0].Rows[0]["WL_TYPE"].ToString() != "NCR" && dtsJobDetails.Tables[0].Rows[0]["Vessel_ID"].ToString() == "11"))
                        {
                            if (objBLL.Get_Worklist_Access_ByUser(Convert.ToInt32(Session["USERID"]), "CLOSE", dtsJobDetails.Tables[0].Rows[0]["WL_TYPE"].ToString()))
                            {
                                hplCloseThisJob.Visible = true;
                            }
                        }
                    }


                    hplRework.Visible = false;
                    if (dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString() != "")
                    {
                        if (objBLL.Get_Worklist_Access_ByUser(Convert.ToInt32(Session["USERID"]), "REWORK", dtsJobDetails.Tables[0].Rows[0]["WL_TYPE"].ToString()))
                        {
                            hplRework.Visible = true;
                        }
                    }


                    string CREATED_DATE   = dtsJobDetails.Tables[0].Rows[0]["CREATED_DATE"].ToString() == "" ? "" : "<br>" + dtsJobDetails.Tables[0].Rows[0]["CREATED_DATE"].ToString();
                    string MODIFIED_DATE  = dtsJobDetails.Tables[0].Rows[0]["MODIFIED_DATE"].ToString() == "" ? "" : "<br>" + dtsJobDetails.Tables[0].Rows[0]["MODIFIED_DATE"].ToString();
                    string VERIFIED_DATE  = dtsJobDetails.Tables[0].Rows[0]["VERIFIED_DATE"].ToString() == "" ? "" : "<br>" + dtsJobDetails.Tables[0].Rows[0]["VERIFIED_DATE"].ToString();
                    string COMPLETED_DATE = dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString() == "" ? "" : "<br>" + dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString();


                    if (dtsJobDetails.Tables[0].Rows.Count > 0)
                    {
                        this.Title = "Job: " + dtsJobDetails.Tables[0].Rows[0]["WLID_DISPLAY"].ToString() + "/" + dtsJobDetails.Tables[0].Rows[0]["VESSEL_SHORT_NAME"].ToString();

                        lblVesselName.Text        = dtsJobDetails.Tables[0].Rows[0]["Vessel_Name"].ToString();
                        lblVesselName.NavigateUrl = "../../Crew/CrewListHistory.aspx?VesselID=" + dtsJobDetails.Tables[0].Rows[0]["VESSEL_ID"].ToString();


                        lblVesselCode.Text        = dtsJobDetails.Tables[0].Rows[0]["Vessel_Code"].ToString();
                        lblVesselCode.NavigateUrl = "../../Crew/CrewListHistory.aspx?VesselID=" + dtsJobDetails.Tables[0].Rows[0]["VESSEL_ID"].ToString();

                        lbljobCode.Text   = dtsJobDetails.Tables[0].Rows[0]["WLID_DISPLAY"].ToString();
                        lblJobStatus.Text = dtsJobDetails.Tables[0].Rows[0]["WL_STATUS_DISPLAY"].ToString();

                        lblReqsnStatus.Text = " - " + dtsJobDetails.Tables[0].Rows[0]["REQSN_STATUS"].ToString();


                        if (dtsJobDetails.Tables[0].Rows[0]["VESSEL_ID"].ToString().ToUpper() != "11" && dtsJobDetails.Tables[0].Rows[0]["WORKLIST_ID"].ToString() == "0")
                        {
                            pnlViewCrewInvolve.Visible = false;
                        }


                        lblCompletedOn.Text = "";

                        if (dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString() != "")
                        {
                            temp = Convert.ToDateTime(dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString()).ToString("dd-MMM-yyyy").ToString();
                            lblCompletedOn.Text = temp == "01-Jan-1900" ? "" : temp;
                        }


                        if (dtsJobDetails.Tables[0].Rows[0]["WL_TYPE"].ToString() == "NCR")
                        {
                            lblNCRNo.Text              = dtsJobDetails.Tables[0].Rows[0]["NCR_NUM"].ToString() + " / " + dtsJobDetails.Tables[0].Rows[0]["NCR_YEAR"].ToString();
                            lblNCRNoCap.Visible        = true;
                            pnlNCRRelated.Visible      = true;
                            pnlRootCause.Visible       = false;
                            lblCompletedOnCaption.Text = "Closed On/By";
                        }
                        else
                        {
                            lblNCRNo.Text         = "";
                            lblNCRNoCap.Visible   = false;
                            pnlNCRRelated.Visible = false;
                            pnlRootCause.Visible  = false;
                        }


                        try
                        {
                            if (dtsJobDetails.Tables[0].Rows[0]["Verified_By_Name"].ToString() != "")
                            {
                                pnlRootCause.Visible = true;


                                lknCompletedBy.Text = dtsJobDetails.Tables[0].Rows[0]["Verified_By_Name"].ToString() + VERIFIED_DATE;
                                if (dtsJobDetails.Tables[0].Rows[0]["Verified_By_CrewID"].ToString() != "")
                                {
                                    lknCompletedBy.NavigateUrl = "~/crew/crewdetails.aspx?ID=" + dtsJobDetails.Tables[0].Rows[0]["Verified_By_CrewID"].ToString();
                                }
                            }
                            else
                            {
                                lknCompletedBy.Visible = false;
                            }
                        }
                        catch (Exception ex)
                        {
                            UDFLib.WriteExceptionLog(ex);
                            lknCompletedBy.Visible = false;
                        }


                        if (dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString() != "")
                        {
                            lblCompletedOn.Text = dtsJobDetails.Tables[0].Rows[0]["Modified_By_Name"].ToString() + COMPLETED_DATE;
                            if (dtsJobDetails.Tables[0].Rows[0]["Modified_By_Name"].ToString() != "")
                            {
                                lblCompletedOn.NavigateUrl = "~/crew/crewdetails.aspx?ID=" + dtsJobDetails.Tables[0].Rows[0]["Modified_By_CrewID"].ToString();
                            }
                        }
                        else
                        {
                            lblCompletedOn.Visible = false;
                        }

                        if (dtsJobDetails.Tables[0].Rows[0]["DATE_RAISED"].ToString() != "")
                        {
                            temp             = Convert.ToDateTime(dtsJobDetails.Tables[0].Rows[0]["DATE_RAISED"].ToString()).ToString("dd/MM/yyyy");
                            lblRaisedOn.Text = temp == "01-Jan-1900" ? "" : temp;
                        }
                        if (dtsJobDetails.Tables[0].Rows[0]["DATE_ESTMTD_CMPLTN"].ToString() != "")
                        {
                            temp = Convert.ToDateTime(dtsJobDetails.Tables[0].Rows[0]["DATE_ESTMTD_CMPLTN"].ToString()).ToString("dd/MM/yyyy");
                            lblExpectedCompletion.Text = temp == "01-Jan-1900" ? "" : temp;
                        }


                        lblPIC.Text          = dtsJobDetails.Tables[0].Rows[0]["PIC_Name"].ToString();
                        lblDeptonShip.Text   = dtsJobDetails.Tables[0].Rows[0]["onship_DEPT"].ToString();
                        lblDeptinOffice.Text = dtsJobDetails.Tables[0].Rows[0]["INOFFICE_DEPT"].ToString();
                        lbljobType.Text      = dtsJobDetails.Tables[0].Rows[0]["Worklist_Type"].ToString();//dtsJobDetails.Tables[0].Rows[0]["NCR"].ToString() == "0" ? "JOB" : "NCR";
                        lblAssignedBy.Text   = dtsJobDetails.Tables[0].Rows[0]["AssignorName"].ToString();
                        // Added for Vetting
                        if (lblAssignedBy.Text == "Vetting")
                        {
                            pnlVetting.Visible = true;
                        }
                        else
                        {
                            pnlVetting.Visible = false;
                        }
                        lnkRequisitionNumber.Text = Convert.ToString(dtsJobDetails.Tables[0].Rows[0]["REQSN_MSG_REF"].ToString()) == "0" ? "" : dtsJobDetails.Tables[0].Rows[0]["REQSN_MSG_REF"].ToString();

                        if (dtsJobDetails.Tables[0].Rows[0]["DOCUMENT_CODE"].ToString() != "")
                        {
                            lnkRequisitionNumber.NavigateUrl = "~/Purchase/RequisitionSummary.aspx?REQUISITION_CODE=" + dtsJobDetails.Tables[0].Rows[0]["REQSN_MSG_REF"].ToString() + "&Document_Code=" + dtsJobDetails.Tables[0].Rows[0]["DOCUMENT_CODE"].ToString() + "&Vessel_Code=" + VesselID.ToString();
                        }
                        else
                        {
                            lnkRequisitionNumber.NavigateUrl = "";
                        }

                        lblNature.Text           = dtsJobDetails.Tables[0].Rows[0]["NATURENAME"].ToString();
                        lblPrimary.Text          = dtsJobDetails.Tables[0].Rows[0]["PRIMARYNAME"].ToString();
                        lblSecondary.Text        = dtsJobDetails.Tables[0].Rows[0]["SECONDARYNAME"].ToString();
                        lblMinorCategory.Text    = Convert.ToString(dtsJobDetails.Tables[0].Rows[0]["CATEGORY_MINOR"]) == "-1" ? "" : Convert.ToString(dtsJobDetails.Tables[0].Rows[0]["MINORNAME"]);
                        lbldescription.Text      = dtsJobDetails.Tables[0].Rows[0]["JOB_DESCRIPTION"].ToString().Replace("\n", "<br>");
                        lblCauses.Text           = dtsJobDetails.Tables[0].Rows[0]["Causes"].ToString().Replace("\n", "<br>");
                        lblCorrectiveAction.Text = dtsJobDetails.Tables[0].Rows[0]["Correc_Action"].ToString().Replace("\n", "<br>");
                        lblPreventiveAction.Text = dtsJobDetails.Tables[0].Rows[0]["Preven_Action"].ToString().Replace("\n", "<br>");
                        lblDeferToDD.Text        = (dtsJobDetails.Tables[0].Rows[0]["DEFER_TO_DD"].ToString() == "0") ? "NO" : "YES";
                        lblPriority.Text         = dtsJobDetails.Tables[0].Rows[0]["Priority_Name"].ToString();
                        lblInspector.Text        = dtsJobDetails.Tables[0].Rows[0]["Inspector_Name"].ToString();
                        lblPSCSIRE.Text          = dtsJobDetails.Tables[0].Rows[0]["PSC_SIRE_Name"].ToString();

                        if (dtsJobDetails.Tables[0].Rows[0]["INSPECTION_DATE"].ToString() != "")
                        {
                            lblInspectionDate.Text = DateTime.Parse(dtsJobDetails.Tables[0].Rows[0]["INSPECTION_DATE"].ToString()).ToString("dd/MM/yyyy");
                        }
                        else
                        {
                            lblInspectionDate.Text = "";
                        }



                        if (dtsJobDetails.Tables[0].Rows[0]["Verified_By_CrewID"].ToString() != "")
                        {
                            lnkVerifiedBy.Text        = dtsJobDetails.Tables[0].Rows[0]["Verified_By_Name"].ToString() + VERIFIED_DATE;
                            lnkVerifiedBy.NavigateUrl = "~/crew/crewdetails.aspx?ID=" + dtsJobDetails.Tables[0].Rows[0]["Verified_By_CrewID"].ToString();
                        }
                        else
                        {
                            lnkVerifiedBy.Visible = false;
                        }

                        //------------- Followup list ------------------
                        LoadFollowUps(_OfficeID, VesselID, WorklistID);

                        //--------------Attachments --------------------
                        Load_Attachments(VesselID, WorklistID, _OfficeID, GetSessionUserID());

                        if (dtsJobDetails.Tables[0].Rows[0]["AssignorName"].ToString().ToUpper() == "CREW COMPLAINT")
                        {
                            Load_CrewComplaintsLog();
                            pnlCrewComplaint.Visible = true;
                        }
                        else
                        {
                            pnlCrewComplaint.Visible = false;
                        }

                        if (WorklistID != 0 && (dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString() == "01/01/1900" || dtsJobDetails.Tables[0].Rows[0]["DATE_COMPLETED"].ToString() == ""))
                        {
                            btnEditJob.Visible = true;
                        }
                        else
                        {
                            btnEditJob.Visible = false;
                        }


                        //--- Enable/Disable Follow-up and Attachments
                        if (dtsJobDetails.Tables[0].Rows[0]["IsVessel"].ToString() == "1")
                        {
                            if (UDFLib.ConvertToInteger(dtsJobDetails.Tables[0].Rows[0]["WORKLIST_ID"].ToString()) == 0)
                            {
                                ImgBtnAddFollowup.Visible = false;
                                pnlAddAttachment.Visible  = false;
                            }
                            else
                            {
                                ImgBtnAddFollowup.Visible = (string.IsNullOrWhiteSpace(lblCompletedOn.Text) != true) ? false : true;
                                pnlAddAttachment.Visible  = (string.IsNullOrWhiteSpace(lblCompletedOn.Text) != true) ? false : true;
                            }
                        }
                        else
                        {
                            ImgBtnAddFollowup.Visible = (string.IsNullOrWhiteSpace(lblCompletedOn.Text) != true) ? false : true;
                            pnlAddAttachment.Visible  = (string.IsNullOrWhiteSpace(lblCompletedOn.Text) != true) ? false : true;
                        }
                    }

                    // Bind vetting and observation details
                    if (dtsJobDetails.Tables[1].Rows.Count > 0)
                    {
                        lblVetting.Text     = dtsJobDetails.Tables[1].Rows[0]["VettingName"].ToString();
                        lblSelectedObs.Text = dtsJobDetails.Tables[1].Rows[0]["Description"].ToString();
                        txtObersvation.Text = dtsJobDetails.Tables[1].Rows[0]["Description"].ToString();
                        BindObservationJobs(int.Parse(dtsJobDetails.Tables[1].Rows[0]["Observation_ID"].ToString()), "Observation");
                        BindVettingJobs(int.Parse(dtsJobDetails.Tables[1].Rows[0]["Vetting_ID"].ToString()), "Vetting");
                    }
                    // Bind Observation Response
                    if (dtsJobDetails.Tables[2].Rows.Count > 0)
                    {
                        GvObservation.DataSource = dtsJobDetails.Tables[2];
                        GvObservation.DataBind();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }

        UpdatePanel2.Update();
    }
Exemple #6
0
    private void BindDeliveryItem()
    {
        DataSet ds = BLL_POLOG_Delivery.POLOG_Get_Delivery_Item_Details(UDFLib.ConvertToInteger(Request.QueryString["ID"].ToString()), UDFLib.ConvertToInteger(txtDeliveryID.Text));

        if (ds.Tables[0].Rows.Count > 0)
        {
            txtDelivery_ItemID.Text = ds.Tables[0].Rows[0]["Delivery_Item_ID"].ToString();
            // txtDeliveryID.Text = ds.Tables[0].Rows[0]["ID"].ToString();
            txtName.Text     = ds.Tables[0].Rows[0]["Delivered_Item_Name"].ToString();
            txtPoQty.Text    = ds.Tables[0].Rows[0]["POQty"].ToString();
            txtPoPrice.Text  = ds.Tables[0].Rows[0]["POprice"].ToString();
            txtConQty.Text   = ds.Tables[0].Rows[0]["DeliveryQty"].ToString();
            txtConPrice.Text = ds.Tables[0].Rows[0]["DeliveryPrice"].ToString();
            txtRemarks.Text  = ds.Tables[0].Rows[0]["Delivered_Item_Description"].ToString();

            lblPOUnit.Text           = ds.Tables[0].Rows[0]["Item_Unit"].ToString();
            lblPOCurrency.Text       = ds.Tables[0].Rows[0]["Currency"].ToString();
            txtDeliveryUnit.Text     = ds.Tables[0].Rows[0]["Delivered_Item_Unit"].ToString();
            lblDeliveryCurrency.Text = ds.Tables[0].Rows[0]["Currency"].ToString();;
        }
        else
        {
            txtName.Text    = "Non PO Item";
            txtPoQty.Text   = "0.00";
            txtPoPrice.Text = "0.00";
        }
    }
Exemple #7
0
    protected void Requisition_Processing_Time()
    {
        BLL_Infra_VesselLib       objVsl         = new BLL_Infra_VesselLib();
        BLL_PURC_Purchase         objTechService = new BLL_PURC_Purchase();
        BLL_Infra_UserCredentials objUserFlt     = new BLL_Infra_UserCredentials();
        DataTable dtEmptyTable = new DataTable();

        DataTable FleetDT = objVsl.GetFleetList(Convert.ToInt32(Session["USERCOMPANYID"].ToString()));
        DataTable DeptDt  = objTechService.GetDeptType();

        dtEmptyTable.Columns.Add("Message");
        DataRow drEmpty = dtEmptyTable.NewRow();

        drEmpty[0] = "No record found !";
        dtEmptyTable.Rows.Add(drEmpty);

        DataTable dtUserFleet = objUserFlt.Get_Fleet_By_UserID(Convert.ToInt32(Session["USERID"].ToString()));

        if (dtUserFleet.Rows.Count > 0)
        {
            Table tbl_Reqsn_Time = new Table();
            tbl_Reqsn_Time.CssClass    = "tbl-css-dash";
            tbl_Reqsn_Time.CellPadding = 0;
            tbl_Reqsn_Time.CellSpacing = 1;


            foreach (DataRow drflt in FleetDT.Rows)
            {
                // get the fleets based on vessels assigned to loged in user
                DataRow[] drUserFleet = dtUserFleet.Select("fleetcode='" + drflt["code"].ToString() + "'");
                if (drUserFleet.Length > 0)
                {
                    TableRow  tr_Reqsn_Time_HD_Fleet    = new TableRow();
                    TableCell cl_Reqsn_Time_HD_Fleet    = new TableCell();
                    TableRow  tr_Reqsn_Time_HD_FormType = new TableRow();
                    Label     lblHD         = new Label();
                    TableRow  tr_Reqsn_Time = new TableRow();
                    tr_Reqsn_Time.CssClass          = "td-css-dash";
                    cl_Reqsn_Time_HD_Fleet.CssClass = "cell-HD-css";

                    lblHD.Text = drflt["Name"].ToString();

                    cl_Reqsn_Time_HD_Fleet.Controls.Add(lblHD);
                    tr_Reqsn_Time_HD_Fleet.Controls.Add(cl_Reqsn_Time_HD_Fleet);
                    tbl_Reqsn_Time.Controls.Add(tr_Reqsn_Time_HD_Fleet);


                    foreach (DataRow drDep in DeptDt.Rows)
                    {
                        if (drDep["Short_Code"].ToString() != "ALL")
                        {
                            DataTable dtReqsnCount = BLL_Infra_DashBoard.Get_Reqsn_Processing_Time(drDep["Short_Code"].ToString(), UDFLib.ConvertToInteger(drflt["code"].ToString()), Convert.ToInt32(Session["USERID"].ToString()));

                            TableCell cl_Reqsn_Time             = new TableCell();
                            TableCell cl_Reqsn_Time_HD_FormType = new TableCell();
                            cl_Reqsn_Time_HD_FormType.Text     = drDep["Description"].ToString();
                            cl_Reqsn_Time.CssClass             = "td-css-dash";
                            cl_Reqsn_Time_HD_FormType.CssClass = "cell-HD-css";

                            GridView gvReqsnTime = new GridView();
                            gvReqsnTime.ID = "gvReqsnTime" + drflt["code"].ToString() + drDep["Short_Code"].ToString();
                            if (dtReqsnCount.Rows.Count > 0)
                            {
                                gvReqsnTime.DataSource = dtReqsnCount;
                            }
                            else
                            {
                                gvReqsnTime.DataSource = dtEmptyTable;
                            }
                            gvReqsnTime.DataBind();

                            gvReqsnTime.EmptyDataText                = "No record found !";
                            gvReqsnTime.AutoGenerateColumns          = true;
                            gvReqsnTime.RowStyle.CssClass            = "RowStyle-css-dash";
                            gvReqsnTime.AlternatingRowStyle.CssClass = "AlternatingRowStyle-css-dash";
                            gvReqsnTime.HeaderStyle.CssClass         = "HeaderStyle-css-dash";

                            tr_Reqsn_Time_HD_FormType.Controls.Add(cl_Reqsn_Time_HD_FormType);
                            cl_Reqsn_Time.Controls.Add(gvReqsnTime);
                            tr_Reqsn_Time.Controls.Add(cl_Reqsn_Time);
                        }
                    }
                    tbl_Reqsn_Time.Controls.Add(tr_Reqsn_Time_HD_FormType);
                    tbl_Reqsn_Time.Controls.Add(tr_Reqsn_Time);
                }
            }
            phReqsnProcessingTime.Controls.Add(tbl_Reqsn_Time);
        }
    }
Exemple #8
0
    protected void SaveDepartmentList()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("PKID");
        dt.Columns.Add("FKID");
        dt.Columns.Add("Value");

        foreach (ListItem chkitem in chkDepartment.Items)
        {
            DataRow dr = dt.NewRow();
            dr["FKID"]  = chkitem.Value;
            dr["Value"] = chkitem.Selected == true ? 1 : 0;
            if (chkitem.Selected == true)
            {
                dt.Rows.Add(dr);
            }
        }
        objBllGroup.INS_Approval_Group_Department(UDFLib.ConvertIntegerToNull(txtGroupID.Text.ToString()), dt, rdbDepartment.SelectedValue, UDFLib.ConvertToInteger(Session["UserID"].ToString()));
    }
    protected void btnSaveNew_Click(object sender, EventArgs e)
    {
        try
        {
            string  Due_Date = ddlYear_AddNew.SelectedValue + "/" + ddlMonth_AddNew.SelectedValue + "/" + DateTime.DaysInMonth(UDFLib.ConvertToInteger(ddlYear_AddNew.SelectedValue), UDFLib.ConvertToInteger(ddlMonth_AddNew.SelectedValue)).ToString();
            decimal Amount   = UDFLib.ConvertToDecimal(txtAmount_AddNew.Text);
            string  Remarks  = txtRemarks.Text;

            int Res = BLL_Crew_Disbursement.AddNew_ProcessingFee(UDFLib.ConvertToInteger(CrewID.Value), UDFLib.ConvertToInteger(Vessel_ID.Value), UDFLib.ConvertToInteger(VoyageID.Value), UDFLib.ConvertToInteger(ManningOfficeID.Value), UDFLib.ConvertToInteger(ddlFeeType_AddNew.SelectedValue), Amount, Due_Date, GetSessionUserID(), Remarks);

            if (Res == 1)
            {
                Load_CrewProcessingFee();
                string js = "alert('Fee added successfully.');hideModal('dvAddNewDisb');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "msg1", js, true);
            }
        }
        catch (Exception ex)
        {
            string js = "alert('" + ex.Message.Replace("'", "") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "msg2", js, true);
        }
    }
    protected void ImgExpExcel_Click(object sender, EventArgs e)
    {
        int Pageset  = 1;
        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_ASL_Supplier.Get_Proposed_Supplier_Search(txtfilter.Text != "" ? txtfilter.Text : null, null, sortbycoloumn, sortdirection
                                                                     , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount, UDFLib.ConvertToInteger(Session["UserID"].ToString()), Pageset);

        string[] HeaderCaptions  = { "Supplier Name", "ProPose Status", "Address", "Phone", "Email", "PIC Name", };
        string[] DataColumnsName = { "Supplier_Name", "Propose_Status", "Address", "Phone", "Email", "PIC_NAME", };

        GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "ProposedSupplier", "Proposed Supplier", "");
    }
    private void BindProposedStatusDDL()
    {
        try
        {
            DataTable dt = BLL_ASL_Supplier.Get_ASL_System_SupplierProposed_Parameter(1, null, UDFLib.ConvertToInteger(Session["UserID"].ToString()));
            DataRow   dr = dt.NewRow();

            dr[0] = "0";
            dr[1] = "All";
            dr[2] = "All";
            dr[3] = "1";
            dt.Rows.Add(dr);

            ddlStatus.DataSource     = dt;
            ddlStatus.DataValueField = "Code";
            ddlStatus.DataTextField  = "Name";
            ddlStatus.DataBind();
        }
        catch
        {
        }
    }
    public void BindGrid()
    {
        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?StatusID = UDFLib.ConvertIntegerToNull(status);

        DataTable dt = BLL_ASL_Supplier.Get_Proposed_Supplier_Search(txtfilter.Text != "" ? txtfilter.Text : null, StatusID, sortbycoloumn, sortdirection
                                                                     , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount, UDFLib.ConvertToInteger(Session["UserID"].ToString()), Pageset);


        if (ucCustomPagerItems.isCountRecord == 1)
        {
            ucCustomPagerItems.CountTotalRec = rowcount.ToString();
            ucCustomPagerItems.BuildPager();
        }

        if (dt.Rows.Count > 0)
        {
            gvProposedSupp.DataSource = dt;
            gvProposedSupp.DataBind();
        }
        else
        {
            gvProposedSupp.DataSource = dt;
            gvProposedSupp.DataBind();
        }
    }
    protected void Load_VesselMinCTM()
    {
        DataTable dt = BLL_PB_PortageBill.Get_VesselMinCTM(UDFLib.ConvertToInteger(ddlFleet.SelectedValue), UDFLib.ConvertToInteger(ddlVessel.SelectedValue), GetSessionUserID());

        gvVesselMinCTM.DataSource = dt;
        gvVesselMinCTM.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["InspID"] != null && Request.QueryString["InspectorID"] != null && Request.QueryString["ScheduleID"] != null)
            {
                if (Request.QueryString["InspID"].ToString().Trim() != "" && Request.QueryString["InspectorID"].ToString() != "" && Request.QueryString["ScheduleID"] != "")
                {
                    int ScheduleID = UDFLib.ConvertToInteger(Request.QueryString["ScheduleID"].ToString());
                    ViewState["ScheduleID"]  = Request.QueryString["ScheduleID"].ToString();
                    ViewState["InspectorID"] = Request.QueryString["InspectorID"].ToString();
                    ViewState["InspID"]      = Request.QueryString["InspID"].ToString();
                    string CheckListIDS = GetChecklist(ScheduleID);

                    GetVesselAttendance(Convert.ToInt32(Request.QueryString["InspectorID"].ToString()), UDFLib.ConvertToInteger(Request.QueryString["InspID"].ToString()));

                    GetCHCategoryRating(Convert.ToInt32(Request.QueryString["InspID"].ToString()));
                }
            }
        }
    }
Exemple #15
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);
        }
    }
Exemple #16
0
    public void BindGrid()
    {
        try
        {
            string  SupplierID = GetSuppID();
            int     ID         = GetChangeRequestID();
            DataSet ds         = BLL_ASL_Supplier.Get_ChangeRequest_Search(UDFLib.ConvertStringToNull(SupplierID), ID, GetSessionUserID());
            lblSupplierCode.Text = GetSuppID();
            hdnCRStatus.Value    = ds.Tables[0].Rows[0]["Check_Status"].ToString();
            hdnCRStatus1.Value   = ds.Tables[0].Rows[0]["Check_Status1"].ToString();
            hdnCRID.Value        = ds.Tables[0].Rows[0]["CRID"].ToString();
            Session["dsCR"]      = ds;
            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                ds.Relations.Add(new DataRelation("NestedCat", ds.Tables[1].Columns["ID"], ds.Tables[0].Columns["ID"]));

                ds.Tables[1].TableName = "Members";

                rpt1.DataSource = ds.Tables[1];
                rpt1.DataBind();
                if (dr["Check_Status"].ToString() == "SUBMITTED")
                {
                    //btnSaveDraft.Visible = false;
                    btnRecallDraft.Visible   = false;
                    btnRecallApprove.Visible = false;
                    btnSubmitRequest.Visible = false;
                    lblSubmittedBY.Text      = dr["Login_Name"].ToString();
                    lblSubmitteddate.Text    = dr["Verified_Date"].ToString();
                    if (UDFLib.ConvertToInteger(GetSessionUserID()) == UDFLib.ConvertToInteger(dr["Verified_By"].ToString()))
                    {
                        btnRecallRequest.Enabled = true;
                        btnRecallRequest.Visible = true;
                        trSubmitted.Visible      = true;
                    }
                    else
                    {
                        btnRecallRequest.Enabled = false;
                        btnRecallRequest.Visible = true;
                        btnApprove.Visible       = true;
                        btnReject.Visible        = true;
                        btnFinalApprove.Visible  = true;
                    }
                    //Check Approver
                    if (objUAType.Approve == 1)
                    {
                        //SetControl(true);
                        btnApprove.Visible      = true;
                        btnReject.Visible       = true;
                        btnFinalApprove.Visible = false;
                        btnFinalApprove.Enabled = true;
                        btnApprove.Enabled      = true;
                        btnReject.Enabled       = true;
                    }
                    else
                    {
                        btnApprove.Enabled      = false;
                        btnReject.Enabled       = false;
                        btnFinalApprove.Enabled = false;
                    }
                }
                else if (dr["Check_Status"].ToString() == "APPROVED")
                {
                    btnRecallDraft.Visible   = false;
                    btnSubmitRequest.Visible = false;
                    btnRecallRequest.Visible = false;
                    lblSubmittedBY.Text      = dr["Login_Name"].ToString();
                    lblSubmitteddate.Text    = dr["Verified_Date"].ToString();
                    if (objUAType.Approve == 1)
                    {
                        // SetControl(true);
                        btnApprove.Visible      = false;
                        btnReject.Visible       = true;
                        btnFinalApprove.Visible = true;
                        btnFinalApprove.Enabled = true;
                        btnApprove.Enabled      = true;
                        btnReject.Enabled       = true;
                    }
                    else
                    {
                        btnApprove.Enabled      = false;
                        btnReject.Enabled       = false;
                        btnFinalApprove.Enabled = false;
                    }
                }
                else
                {
                    //EnableDisable(true);
                    btnFinalApprove.Visible  = false;
                    btnApprove.Visible       = false;
                    btnReject.Visible        = false;
                    btnRecallRequest.Enabled = false;
                }
            }
            else
            {
                //EnableDisable(true);
                btnFinalApprove.Visible  = false;
                btnApprove.Visible       = false;
                btnReject.Visible        = false;
                btnRecallRequest.Enabled = false;
                if (objUA.Add == 1)
                {
                    //SetControl(true);
                    //btnSaveDraft.Visible = true;
                    btnSubmitRequest.Visible = true;
                }
                else
                {
                    //btnSaveDraft.Visible = false;
                    btnSubmitRequest.Visible = false;
                }
                if (objUAType.Add == 1)
                {
                    //SetControl(true);
                    //btnSaveDraft.Visible = true;
                    btnSubmitRequest.Visible = true;
                }
                else
                {
                    //btnSaveDraft.Visible = false;
                    btnSubmitRequest.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemple #17
0
    protected void btnUpdateInspection_Click(object sender, EventArgs e)
    {
        try
        {
            string js;

            if (UDFLib.ConvertDateToNull(txtInsectionDate.Text) == null)
            {
                js = "handleStatus();alert('Select valid date.');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true);
                return;
            }
            if (DDLInspectorA.SelectedIndex == 0)
            {
                js = "handleStatus();alert('Select valid inspector.');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true);
                return;
            }
            int    onboard = 0;
            int    onshore = 0;
            string Status  = "Pending";


            if (rdbPlanned.Checked)
            {
                if (UDFLib.ConvertIntegerToNull(txtDurJobsU.Text) == null)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "handleStatus();alert('Duration is not valid.');", true);
                    return;
                }
                if (UDFLib.ConvertIntegerToNull(txtDurJobsU.Text) <= 0)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "handleStatus();alert('Duration cannot be smaller than or equal to zero.');", true);
                    return;
                }
            }
            if (rdbCompleted.Checked)
            {
                if (UDFLib.ConvertDateToNull(txtCompletionDate.Text) != null)
                {
                    if (UDFLib.ConvertDateToNull(txtCompletionDate.Text).Value.Date < UDFLib.ConvertDateToNull(txtInsectionDate.Text).Value.Date)
                    {
                        txtCompletionDate.Text = "";
                        txtOnboard.Text        = "";
                        txtOnShore.Text        = "";
                        txtDuration.Text       = "";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "handleStatus();alert('Completion date can not be lesser than the scheduled date.');", true);
                        return;
                    }
                    txtDuration.Text = (UDFLib.ConvertDateToNull(txtCompletionDate.Text).Value.Date.AddDays(1) - UDFLib.ConvertDateToNull(txtInsectionDate.Text).Value.Date).Days.ToString();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "alert('Completion date can not be empty.');handleStatus();", true);
                    return;
                }

                Status = "Completed";

                try
                {
                    onboard = Convert.ToInt32(txtOnboard.Text);
                }
                catch (Exception)
                {
                    js = "handleStatus();alert('Onboard duration is not valid.');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true);
                    return;
                }

                try
                {
                    onshore = Convert.ToInt32(txtOnShore.Text);
                }
                catch (Exception)
                {
                    js = "handleStatus();alert('Onshore duration is not valid.');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true);
                    return;
                }

                int duration = Convert.ToInt32(txtDuration.Text);

                if (duration != (onboard + onshore))
                {
                    js = "handleStatus();alert('Sum of onboard value and onshore should match duration value.');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true);
                    return;
                }
                if ((Convert.ToInt32(txtOnShore.Text) < 0) || (Convert.ToInt32(txtOnboard.Text) < 0))
                {
                    js = "handleStatus();alert('Onboard value or onshore value can not be negative.');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true);
                    return;
                }

                if (UDFLib.ConvertDateToNull(txtCompletionDate.Text).Value.Date > DateTime.Now.Date)
                {
                    js = "handleStatus();alert('Completion date cannot be a future date.');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", js, true);
                    return;
                }
            }

            if (DDLPort.SelectedIndex == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "handleStatus();alert('No ports selected.');", true);
                return;
            }


            objInsp.Update_Inspection(UDFLib.ConvertToInteger(ViewState["SchDetailId"]), UDFLib.ConvertToInteger(DDLInspectorA.SelectedValue), UDFLib.ConvertDateToNull(txtInsectionDate.Text), Status, GetSessionUserID(), onboard, onshore, UDFLib.ConvertDateToNull(txtCompletionDate.Text), UDFLib.ConvertIntegerToNull(txtDurJobsU.Text));

            DataTable dtPortList = NewDaemonPortList();
            dtPortList.Rows.Add(DDLPort.SelectedValue.ToString());

            foreach (string newPortid in hdfNewinspectionPortid.Value.Split(','))
            {
                if (UDFLib.ConvertToInteger(newPortid) > 0 && dtPortList.Rows.Find(UDFLib.ConvertToInteger(newPortid)) == null)
                {
                    dtPortList.Rows.Add((dtPortList.NewRow()["PortID"] = newPortid));
                }
            }


            objInsp.INSP_InsertUpdate_InspectionPort(dtPortList, UDFLib.ConvertToInteger(ViewState["SchDetailId"]), GetSessionUserID());
            js = "handleStatus();alert('Inspection updated successfully.');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true);

            js = "handleStatus();hideModal('dvUpdateInspe');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "dvUpdateInspe", js, true);
            Load_Current_Schedules();
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemple #18
0
    protected void rpt1_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
    {
        DataRowView dv = e.Item.DataItem as DataRowView;
        //Image ImgCard = ((ImageButton)e.Item.FindControl("ImgView"));
        RequiredFieldValidator val  = (RequiredFieldValidator)e.Item.FindControl("RequiredFieldValidator1");
        RequiredFieldValidator val1 = (RequiredFieldValidator)e.Item.FindControl("RequiredFieldValidator2");

        if (dv != null)
        {
            Repeater nestedRepeater = e.Item.FindControl("rpt2") as Repeater;
            if (nestedRepeater != null)
            {
                nestedRepeater.DataSource = dv.CreateChildView("NestedCat");
                nestedRepeater.DataBind();
            }
        }

        if (e.Item.ItemType == ListItemType.Item ||
            e.Item.ItemType == ListItemType.AlternatingItem)
        {
            ((RequiredFieldValidator)e.Item.FindControl("RequiredFieldValidator1")).ValidationGroup = ((DropDownList)e.Item.FindControl("ddlApprover")).UniqueID;
            ((RequiredFieldValidator)e.Item.FindControl("RequiredFieldValidator2")).ValidationGroup = ((DropDownList)e.Item.FindControl("ddlFinalApprover")).UniqueID;
            Label        lblAction          = (Label)e.Item.FindControl("lblAction");
            DropDownList ddlApprover        = (DropDownList)e.Item.FindControl("ddlApprover");
            DropDownList ddlFinalApprover   = (DropDownList)e.Item.FindControl("ddlFinalApprover");
            Label        lblGroup_Name      = (Label)e.Item.FindControl("lblGroup_Name");
            Label        lblGroupID         = (Label)e.Item.FindControl("lblGroupID");
            HiddenField  hdnApproverID      = (HiddenField)e.Item.FindControl("hdnApproverID");
            HiddenField  hdnFinalApproverID = (HiddenField)e.Item.FindControl("hdnFinal_ApproverID");
            string       Approver_Type      = "ChangeRequest";
            DataSet      ds = BLL_ASL_Supplier.Get_Supplier_CR_ApproverList(UDFLib.ConvertToInteger(GetSessionUserID()), GetSessionSupplierType(), Approver_Type, lblGroupID.Text.ToString());
            //DataTable dt = objPortCall.Get_PortCall_PortList(0, UDFLib.ConvertIntegerToNull(DataBinder.Eval(e.Item.DataItem, "Vessel_ID").ToString()), 1);
            if (ds.Tables[1].Rows.Count > 0)
            {
                ddlApprover.DataSource     = ds.Tables[1];
                ddlApprover.DataTextField  = "User_name";
                ddlApprover.DataValueField = "ApproveID";
                ddlApprover.DataBind();
                ddlApprover.Items.Insert(0, new ListItem("SELECT", "0"));
            }
            else
            {
                ddlApprover.Items.Insert(0, new ListItem("SELECT", "0"));
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                ddlFinalApprover.DataSource     = ds.Tables[0];
                ddlFinalApprover.DataTextField  = "User_name";
                ddlFinalApprover.DataValueField = "ApproveID";
                ddlFinalApprover.DataBind();
                ddlFinalApprover.Items.Insert(0, new ListItem("SELECT", "0"));
            }
            else
            {
                ddlFinalApprover.Items.Insert(0, new ListItem("SELECT", "0"));
            }
            ddlApprover.SelectedValue      = DataBinder.Eval(e.Item.DataItem, "ApproverID").ToString();
            ddlFinalApprover.SelectedValue = DataBinder.Eval(e.Item.DataItem, "Final_ApproverID").ToString();
            if (hdnCRStatus1.Value.ToString() == "0")
            {
                lblAction.Visible        = false;
                ddlApprover.Enabled      = true;
                ddlFinalApprover.Enabled = true;
            }
            else
            {
                lblAction.Visible        = true;
                ddlApprover.Enabled      = false;
                ddlFinalApprover.Enabled = false;
            }
        }

        if (rpt1 != null && rpt1.Items.Count < 1)
        {
            if (e.Item.ItemType == ListItemType.Footer)
            {
                // Show the Error Label (if no data is present).
                Label lblErrorMsg = e.Item.FindControl("lblErrorMsg") as Label;
                if (lblErrorMsg != null)
                {
                    lblErrorMsg.Visible = true;
                }
            }
        }
    }
Exemple #19
0
    protected void btnDraft_Click(object sender, EventArgs e)
    {
        try
        {
            //string Confirm_Unit = "PC";
            int retval = BLL_POLOG_Delivery.POLog_Insert_Delivery_Item(UDFLib.ConvertIntegerToNull(Request.QueryString["ID"].ToString()), UDFLib.ConvertIntegerToNull(txtDeliveryID.Text),
                                                                       txtName.Text.Trim(), UDFLib.ConvertDecimalToNull(txtPoQty.Text.Trim()), UDFLib.ConvertDecimalToNull(txtPoPrice.Text.Trim()), txtDeliveryUnit.Text,
                                                                       UDFLib.ConvertDecimalToNull(txtConQty.Text.Trim()), UDFLib.ConvertDecimalToNull(txtConPrice.Text.Trim()), txtRemarks.Text.Trim(), UDFLib.ConvertToInteger(GetSessionUserID()));


            string msgDraft = String.Format("parent.ReloadParent_ByButtonID();");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDraft", msgDraft, true);
        }
        catch
        {
        }
    }
Exemple #20
0
    protected int Submit(string CR_Status, string Action_On_Data_Form)
    {
        DataTable dtcr = new DataTable();

        dtcr.Columns.Add("PKID");
        dtcr.Columns.Add("Field_Name");
        dtcr.Columns.Add("Old_Value");
        dtcr.Columns.Add("New_Value");
        dtcr.Columns.Add("Reason_For_Change");
        dtcr.Columns.Add("Approver");
        dtcr.Columns.Add("Final_Approver");

        foreach (RepeaterItem item in rpt1.Items)
        {
            DropDownList ddlApprover      = item.FindControl("ddlApprover") as DropDownList;
            DropDownList ddlFinalApprover = item.FindControl("ddlFinalApprover") as DropDownList;
            Repeater     nestedRepeater   = item.FindControl("rpt2") as Repeater;
            foreach (RepeaterItem nestedItem in nestedRepeater.Items)
            {
                CheckBox chkIsActive          = nestedItem.FindControl("chk") as CheckBox;
                Label    lblFields_Name       = nestedItem.FindControl("lblFieldsName") as Label;
                Label    lblCurrentValue      = nestedItem.FindControl("lblCurrentValue") as Label;
                Label    lblNew_Value         = nestedItem.FindControl("lblNewValue") as Label;
                Label    lblReason_For_Change = nestedItem.FindControl("lblReason_For_Change") as Label;

                if (chkIsActive.Checked == true && chkIsActive != null)
                {
                    DataRow dr = dtcr.NewRow();
                    dr["PKID"]              = 0;
                    dr["Field_Name"]        = lblFields_Name.Text;
                    dr["Old_Value"]         = lblCurrentValue.Text;
                    dr["New_Value"]         = lblNew_Value.Text;
                    dr["Reason_For_Change"] = lblReason_For_Change.Text;
                    dr["Approver"]          = ddlApprover.SelectedValue;
                    dr["Final_Approver"]    = ddlFinalApprover.SelectedValue;
                    dtcr.Rows.Add(dr);
                }
            }
        }
        int RetValue = 0;

        if (dtcr.Rows.Count > 0)
        {
            RetValue      = BLL_ASL_Supplier.Supplier_ChangeRequest_Status_Update(UDFLib.ConvertIntegerToNull(hdnCRID.Value), UDFLib.ConvertStringToNull(lblSupplierCode.Text), dtcr, CR_Status, Action_On_Data_Form, UDFLib.ConvertToInteger(GetSessionUserID()));
            hdnCRID.Value = Convert.ToString(RetValue);
            if (CR_Status == "EFFECTED")
            {
                SaveChildtable(CR_Status, Action_On_Data_Form);
            }
            return(RetValue);
        }
        else
        {
            return(RetValue);
        }
    }
Exemple #21
0
    protected void btnSaveAndClose_Click(object sender, EventArgs e)
    {
        lblMsg.Text    = "";
        lblMsg.Visible = false;
        int REFF = 0;

        if (ViewState["AddEdit"].ToString() == "Add")
        {
            int       MaxID = BLL_Infra_ShipSettings.Ins_RANK_SCREEN_Access(UDFLib.ConvertToInteger(ViewState["ScreenID"].ToString()), txtButtonName.Text.Trim(), UDFLib.ConvertToInteger(Session["UserID"].ToString()), ref REFF);
            DataTable dt    = new DataTable();

            dt.Columns.Add("Rank_ID");
            dt.Columns.Add("RANK_SCREEN_Access_ID");
            dt.Columns.Add("Created_By");

            foreach (ListItem chkitem in chkRanksList.Items)
            {
                DataRow dr = dt.NewRow();
                dr["Rank_ID"] = UDFLib.ConvertToInteger(chkitem.Value);
                dr["RANK_SCREEN_Access_ID"] = MaxID;
                dr["Created_By"]            = UDFLib.ConvertToInteger(Session["UserID"].ToString());

                if (chkitem.Selected == true)
                {
                    dt.Rows.Add(dr);
                }
            }
            if (dt.Rows.Count != 0)
            {
                int    result   = BLL_Infra_ShipSettings.Ins_RANK_SCREEN_Access_Details(dt);
                string Ranklist = String.Format("hideModal('dvAddButton',false);");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Ranklist", Ranklist, true);
                BindScreen_By_SrceenID();
                upDetails.Update();
                ViewState["AddEdit"] = null;
            }
            else
            {
                string Ranklist = "Please select at least one rank..! ";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Ranklist", Ranklist, true);
                lblMsg.Text    = "Please select at least one rank..! ";
                lblMsg.Visible = true;
            }
        }
        else
        {
            int       MaxID = BLL_Infra_ShipSettings.Update_RANK_SCREEN_Access(UDFLib.ConvertToInteger(ViewState["ID"].ToString()), txtButtonName.Text.Trim(), UDFLib.ConvertToInteger(Session["UserID"].ToString()));
            DataTable dt    = new DataTable();

            dt.Columns.Add("Rank_ID");
            dt.Columns.Add("RANK_SCREEN_Access_ID");
            dt.Columns.Add("Created_By");

            foreach (ListItem chkitem in chkRanksList.Items)
            {
                DataRow dr = dt.NewRow();
                dr["Rank_ID"] = UDFLib.ConvertToInteger(chkitem.Value);
                dr["RANK_SCREEN_Access_ID"] = UDFLib.ConvertToInteger(ViewState["ID"].ToString());
                dr["Created_By"]            = UDFLib.ConvertToInteger(Session["UserID"].ToString());

                if (chkitem.Selected == true)
                {
                    dt.Rows.Add(dr);
                }
            }
            if (dt.Rows.Count != 0)
            {
                int    result   = BLL_Infra_ShipSettings.Update_RANK_SCREEN_Access_Details(dt, UDFLib.ConvertToInteger(ViewState["ID"].ToString()));
                string Ranklist = String.Format("hideModal('dvAddButton',false);");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Ranklist", Ranklist, true);
                BindScreen_By_SrceenID();
                upDetails.Update();
                ViewState["AddEdit"] = null;
            }
            else
            {
                string Ranklist = "Please select at least one rank..! ";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Ranklist", Ranklist, true);
                lblMsg.Text    = "Please select at least one rank..! ";
                lblMsg.Visible = true;
            }
        }
    }
Exemple #22
0
    protected int SubmitRequest(string CR_Status, string Action_On_Data_Form)
    {
        int       Str  = 1;
        DataTable dtcr = new DataTable();

        dtcr.Columns.Add("PKID");
        dtcr.Columns.Add("Field_Name");
        dtcr.Columns.Add("Old_Value");
        dtcr.Columns.Add("New_Value");
        dtcr.Columns.Add("Reason_For_Change");
        dtcr.Columns.Add("Approver");
        dtcr.Columns.Add("Final_Approver");

        foreach (RepeaterItem item in rpt1.Items)
        {
            DropDownList ddlApprover      = item.FindControl("ddlApprover") as DropDownList;
            DropDownList ddlFinalApprover = item.FindControl("ddlFinalApprover") as DropDownList;
            Label        lblGroupName     = item.FindControl("lblGroup_Desc") as Label;
            Repeater     nestedRepeater   = item.FindControl("rpt2") as Repeater;
            if (ddlApprover.SelectedValue != "0")
            {
                if (ddlFinalApprover.SelectedValue != "0")
                {
                    foreach (RepeaterItem nestedItem in nestedRepeater.Items)
                    {
                        CheckBox chkIsActive          = nestedItem.FindControl("chk") as CheckBox;
                        Label    lblFields_Name       = nestedItem.FindControl("lblFieldsName") as Label;
                        Label    lblCurrentValue      = nestedItem.FindControl("lblCurrentValue") as Label;
                        Label    lblNew_Value         = nestedItem.FindControl("lblNewValue") as Label;
                        Label    lblReason_For_Change = nestedItem.FindControl("lblReason_For_Change") as Label;
                        DataRow  dr = dtcr.NewRow();
                        dr["PKID"]              = 0;
                        dr["Field_Name"]        = lblFields_Name.Text;
                        dr["Old_Value"]         = lblCurrentValue.Text;
                        dr["New_Value"]         = lblNew_Value.Text;
                        dr["Reason_For_Change"] = lblReason_For_Change.Text;
                        dr["Approver"]          = ddlApprover.SelectedValue;
                        dr["Final_Approver"]    = ddlFinalApprover.SelectedValue;
                        dtcr.Rows.Add(dr);
                    }
                }
                else
                {
                    string ErrorMsg = lblGroupName.Text + " " + "Final Approver Name is mandatory.";
                    Str = -2;
                    string msg2 = String.Format("alert(' " + ErrorMsg + " ')");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
                }
            }
            else
            {
                string ErrorMsg = lblGroupName.Text + " " + "Approver Name is mandatory.";
                Str = -2;
                string msg2 = String.Format("alert(' " + ErrorMsg + " ')");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
            }
        }
        if (Str == 1)
        {
            int RetValue = 0;
            if (dtcr.Rows.Count > 0)
            {
                RetValue      = BLL_ASL_Supplier.Supplier_ChangeRequest_Status_Update(UDFLib.ConvertIntegerToNull(hdnCRID.Value), UDFLib.ConvertStringToNull(lblSupplierCode.Text), dtcr, CR_Status, Action_On_Data_Form, UDFLib.ConvertToInteger(GetSessionUserID()));
                hdnCRID.Value = Convert.ToString(RetValue);

                return(RetValue);
            }
            else
            {
                return(RetValue);
            }
        }
        else
        {
            int RetValue = -2;
            return(RetValue);
        }
    }
Exemple #23
0
    protected void btnSaveGrade_Click(object sender, EventArgs e)
    {
        string    Mode = "A";
        DataTable dt   = ValidateMin_Max();

        if (dt.Rows.Count == 0)
        {
            return;
        }
        int ID = BLL_Infra_DrillQuestionnaire.INS_UPD_DEL_Grading(null, txtGrade.Text.Trim(), 1, UDFLib.ConvertToInteger(ddlMin.SelectedValue), UDFLib.ConvertToInteger(ddlMax.SelectedValue), UDFLib.ConvertToInteger(ddlDivisions.SelectedValue), Convert.ToInt32(Session["USERID"]), Mode);

        for (int i = 0; i < rptOptions.Items.Count; i++)
        {
            TextBox txtValue = (TextBox)rptOptions.Items[i].FindControl("txtValue");
            TextBox txtText  = (TextBox)rptOptions.Items[i].FindControl("txtText");

            if (txtText != null && txtValue != null)
            {
                BLL_Infra_DrillQuestionnaire.INS_UPD_DEL_GradingOption(ID, txtText.Text.Trim(), UDFLib.ConvertToDecimal(txtValue.Text), Convert.ToInt32(Session["USERID"]));
            }
        }
        Bind_Grading();
        Get_Grading_ForQuestions();
        ClearControls_Grade();
    }
Exemple #24
0
 protected void SaveChildtable(string CR_Status, string Action_On_Data_Form)
 {
     try
     {
         BLL_ASL_Supplier.ASL_CR_Supplier_Child_Insert(UDFLib.ConvertIntegerToNull(hdnCRID.Value), UDFLib.ConvertStringToNull(lblSupplierCode.Text), CR_Status, Action_On_Data_Form, UDFLib.ConvertToInteger(GetSessionUserID()));
     }
     catch { }
     {
     }
 }
Exemple #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            btnLoadFiles.Attributes.Add("style", "visibility:hidden");

            CheckSettingforFunctions();

            if (AjaxFileUpload1.IsInFileUploadPostBack)
            {
            }
            else
            {
                if (!IsPostBack)
                {
                    try
                    {
                        OFFID = UDFLib.ConvertToInteger(Request.QueryString["OFFID"]);
                        WLID  = UDFLib.ConvertToInteger(Request.QueryString["WLID"]);
                        VID   = UDFLib.ConvertToInteger(Request.QueryString["VID"]);


                        DataTable dtpkid = (DataTable)Session["WORKLIST_PKID_NAV"];

                        int indexofCurrentpk = dtpkid != null?dtpkid.Rows.IndexOf(dtpkid.Rows.Find(new object[] { WLID, VID, OFFID })) : -1;

                        if (indexofCurrentpk < 0)
                        {
                            dtpkid = new DataTable();
                            dtpkid.Columns.Add("WORKLIST_ID");
                            dtpkid.Columns.Add("VESSEL_ID");
                            dtpkid.Columns.Add("OFFICE_ID");
                            dtpkid.PrimaryKey = new DataColumn[] { dtpkid.Columns["WORKLIST_ID"], dtpkid.Columns["VESSEL_ID"], dtpkid.Columns["OFFICE_ID"] };
                            dtpkid.Rows.Add(new object[] { WLID, VID, OFFID });
                            indexofCurrentpk = 0;
                        }

                        ctlRecordNavigationDetails.InitRecords(dtpkid);

                        ctlRecordNavigationDetails.MoveToIndex(indexofCurrentpk);
                    }
                    catch (Exception ex)
                    {
                        UDFLib.WriteExceptionLog(ex);
                    }
                    UserAccessValidation();
                }
                else
                {
                    string js = "$('#myGallery').galleryView();$('#myGallery2').galleryView();";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "_galleryView", js, true);
                }
                if (Convert.ToString(Request["Mode"]) == "View")
                {
                    EnableDisableControls(false);
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemple #26
0
    protected void btnsave_Click(object sender, EventArgs e)
    {
        //if (HiddenFlag.Value == "Add")
        //{
        if (txtCompName.Text != "")
        {
            txtShortName.Text = txtCompName.Text.Substring(0, 3);
        }

        DataTable dt = objBLL.CheckCompanyExist(txtShortName.Text.Trim());

        if (dt.Rows.Count > 0)
        {
            string js1 = "alert('Company name already exists');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", js1, true);
            //string AddCompmodal = String.Format("showModal('CompanyExist',false);");
            //   ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddCompmodal", AddCompmodal, true);
        }
        else
        {
            int responseid = objBLL.InsertCompany(int.Parse(txtCompCode.Text.Trim()), int.Parse(ddlCompanyType.SelectedValue), txtCompName.Text.Trim(), txtRegNo.Text.Trim()
                                                  , UDFLib.ConvertDateToNull(txtDtIncorp.Text.Trim()), UDFLib.ConvertToInteger(ddlCountryIncorp.SelectedValue), UDFLib.ConvertIntegerToNull(ddlCurrency.SelectedValue), txtAddrerss.Text.Trim()
                                                  , UDFLib.ConvertIntegerToNull(ddlAddressCountry.SelectedValue), txtEmail.Text.Trim(), txtPhone.Text.Trim()
                                                  , UDFLib.ConvertToInteger(Session["UserID"]), txtShortName.Text, txtEmail2.Text, txtPhone2.Text, txtFax1.Text, txtFax2.Text);


            string emailid    = "";
            string ContactDet = "";
            if (txtEmail2.Text != "")
            {
                emailid = txtEmail.Text.Trim() + "," + txtEmail2.Text;
            }
            else
            {
                emailid = txtEmail.Text.Trim();
            }
            if (txtPhone2.Text != "")
            {
                ContactDet = txtPhone.Text.Trim() + "," + txtPhone2.Text;
            }
            else
            {
                ContactDet = txtPhone.Text.Trim();
            }

            if (responseid != -1)
            {
                objBLL.InsertCompanyReletionship(UDFLib.ConvertToInteger(ddlParentCompany.SelectedValue), responseid, UDFLib.ConvertToInteger(ddlRelation.SelectedValue), UDFLib.ConvertToInteger(Session["UserID"]));

                string url = HttpContext.Current.Request.Url.AbsoluteUri;

                string[] segment = url.Split('/');
                string   newstr  = "";



                for (int i = 0; i < segment.Count(); i++)
                {
                    if (segment[i] == "JIBE")
                    {
                        newstr += segment[i].ToString() + "/";
                        break;
                    }
                    //if(i==0)
                    newstr += segment[i].ToString() + "/";
                    //else
                    //    newstr += segment[i].ToString() + "/";
                }

                newstr += "Account/Company.aspx?CompanyType=VesselManager&CompanyID=" + responseid.ToString() + "";// + Session["USERCOMPANYID"] + "";

                btnsave.Enabled = false;

                string js1 = "alert('Saved Successfully');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", js1, true);
                // objBLL.SendSurveyVesselORegistration(emailid, ContactDet, txtCompName.Text.Trim(), newstr);

                //divadd.Visible = false;
                //dvAddtd.Visible = false;
                //divadd.Visible = false;
                //SuccessId.Visible = true;
            }
            else
            {
                string js1 = "alert('Company name already exists');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", js1, true);
            }
        }

        //}
        //else
        //{
        //    int responseid = objBLL.EditCompany(Convert.ToInt32(txtCompanyID.Text), Convert.ToInt32(txtCompCode.Text), Convert.ToInt32(ddlCompanyType.SelectedValue)
        //        , txtCompName.Text, txtShortName.Text, txtRegNo.Text, txtDtIncorp.Text, UDFLib.ConvertIntegerToNull(ddlCountryIncorp.SelectedValue), UDFLib.ConvertIntegerToNull(ddlCurrency.SelectedValue)
        //        , txtAddrerss.Text, UDFLib.ConvertIntegerToNull(ddlAddressCountry.SelectedValue), txtEmail.Text, txtPhone.Text, txtEmail2.Text, txtPhone2.Text, txtFax1.Text, txtFax2.Text, UDFLib.ConvertToInteger(Session["UserID"]));

        //}

        //BindCompany();

        //string hidemodal = String.Format("hideModal('divadd')");
        //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidemodal", hidemodal, true);
    }
    protected void btnSaveRemark_Click(object sender, EventArgs e)
    {
        int   RowIndex       = UDFLib.ConvertToInteger(ViewState["ApproveRowIndex"].ToString());
        Label lblFileID      = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblFileID");
        Label lblFilePath    = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblFilePath");
        Label lblVersion     = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblVersion");
        Label lblStatusID    = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblStatusID");
        Label lblOfficeID    = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblOfficeID");
        Label lblVesselID    = (Label)grdApprovalList.Rows[RowIndex].FindControl("lblVesselID");
        int   Approval_Level = UDFLib.ConvertToInteger(grdApprovalList.DataKeys[RowIndex].Values["Approval_Level"]);
        int   ApprovedBy     = GetSessionUserID();
        int   CreatedBy      = GetSessionUserID();

        objFMS.FMS_Insert_ScheduleFileApproval(UDFLib.ConvertToInteger(lblStatusID.Text), UDFLib.ConvertToInteger(lblOfficeID.Text), UDFLib.ConvertToInteger(lblVesselID.Text), UDFLib.ConvertToInteger(lblFileID.Text), txtRemark.Text, ApprovedBy, CreatedBy, UDFLib.ConvertToInteger(lblVersion.Text), Approval_Level, 1);


        DataSet ds = new DataSet();

        ds = objFMS.FMS_Get_ScheduleFileApprovalByStatus(UDFLib.ConvertToInteger(lblStatusID.Text), UDFLib.ConvertToInteger(lblOfficeID.Text), UDFLib.ConvertToInteger(lblVesselID.Text));
        if (ds.Tables[0].Rows.Count == 0)
        {
            objFMS.FMS_Update_ScheduleStatus(UDFLib.ConvertToInteger(lblStatusID.Text), UDFLib.ConvertToInteger(lblOfficeID.Text), UDFLib.ConvertToInteger(lblVesselID.Text), GetSessionUserID());
        }



        string js = " alert('Form Approved Successfully');";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);

        string js1 = " hideModal('dvRemark');";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "hdModal", js1, true);
        txtRemark.Text = "";
        BindGrid();
    }
Exemple #28
0
    protected void gvInspecrionSchedule_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "onDelete")
            {
                objInsp.Del_ScheduledInspection(UDFLib.ConvertIntegerToNull(e.CommandArgument.ToString()), UDFLib.ConvertIntegerToNull(Session["USERID"]));
                Load_Current_Schedules();
            }
            if (e.CommandName == "ReOpen")
            {
                ViewState["SchDetailId"] = UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[0]);;
            }
            if (e.CommandName.ToUpper() == "EDIT_SCHEDULE")
            {
            }
            if (e.CommandName.ToUpper() == "INSPUPD")
            {
                if (ViewState["edit"].ToString() == "0")
                {
                    btnUpdateInspection.Enabled = false;
                }

                ViewState["ShowImages"]  = 0;
                ViewState["SchDetailId"] = 1;
                string js;

                DataTable dtSup = objInsp.Get_Supritendent_Users(null, UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[8]));

                if (dtSup != null)
                {
                    if (dtSup.Rows.Count > 0)
                    {
                        DDLInspectorA.DataSource     = dtSup;
                        DDLInspectorA.DataTextField  = "Name";
                        DDLInspectorA.DataValueField = "UserID";
                        DDLInspectorA.DataBind();
                        DDLInspectorA.Items.Insert(0, new ListItem("--SELECT--", null));
                        txtInsectionDate.Text = DateTime.Now.ToString("dd/MMM/yy");


                        ViewState["ScheduleID"]  = UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[0]);
                        ViewState["SchDetailId"] = UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[2]);
                        try
                        {
                            try
                            {
                                DDLInspectorA.SelectedValue = e.CommandArgument.ToString().Split(';')[1];
                            }
                            catch (Exception)
                            {
                                DDLInspectorA.SelectedValue = e.CommandArgument.ToString().Split(';')[4];
                            }
                        }
                        catch (Exception)
                        {
                            DDLInspectorA.SelectedIndex = 0;
                        }

                        try
                        {
                            txtInsectionDate.Text = Convert.ToDateTime(e.CommandArgument.ToString().Split(';')[5]).ToString("dd/MMM/yy");
                        }
                        catch (Exception)
                        {
                            txtInsectionDate.Text = Convert.ToDateTime(e.CommandArgument.ToString().Split(';')[6]).ToString("dd/MMM/yy");
                        }

                        try
                        {
                            hdfNewinspectionPortid.Value = "";
                            DataSet   dtAssignPortList = objInsp.INSP_Get_InspectionPort(UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[2]));
                            DataTable dtPort           = objInfra.Get_PortList();

                            DDLPort.DataSource     = dtPort;
                            DDLPort.DataValueField = "PORT_ID";
                            DDLPort.DataTextField  = "PORT_NAME";
                            DDLPort.DataBind();
                            DDLPort.Items.Insert(0, new ListItem("-SELECT-", null));

                            if (dtAssignPortList.Tables[0].Rows.Count > 0)
                            {
                                try
                                {
                                    DDLPort.SelectedValue = dtAssignPortList.Tables[0].Rows[0]["PortID"].ToString();
                                }
                                catch { }
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }


                        txtDurJobsU.Text = e.CommandArgument.ToString().Split(';')[7].ToString();
                        txtDuration.Text = e.CommandArgument.ToString().Split(';')[7].ToString();
                        DateTime dt = Convert.ToDateTime(txtInsectionDate.Text);
                        dt = dt.AddDays(UDFLib.ConvertToDouble(txtDuration.Text) - 1);
                        txtCompletionDate.Text = dt.ToString("dd/MMM/yy");
                        txtOnboard.Text        = "";
                        txtOnShore.Text        = "";
                        txtDuration.Text       = "";
                        rdbCompleted.Checked   = false;
                        rdbPlanned.Checked     = true;

                        js = " $('#divAddSystem').prop('title', 'Update Inspection');showModal('dvUpdateInspe',false);";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "showModalJS", js, true);

                        js = " $('#dvUpdateInspe').prop('title', 'Update Inspection');";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "", js, true);

                        js = "handleStatus();";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "handleModal", js, true);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    public void imgbtnDelete_Click(object s, EventArgs e)
    {
        try
        {
            BLL_Tec_Inspection objAttch = new BLL_Tec_Inspection();

            string[] arg = (((ImageButton)s).CommandArgument.Split(new char[] { ',' }));
            int      res = objAttch.INSP_Delete_Attachments_DL(int.Parse(arg[0]), int.Parse(arg[1]), UDFLib.ConvertToInteger(Session["USERID"]));

            BindInspAttchment();
        }
        catch
        { }
    }
    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();
        }
    }