private void LoadData(string SortExp, string direction)
        {
            string containerNo = string.IsNullOrEmpty(txtContainerNo.Text) ? "" : txtContainerNo.Text.Trim();
            string Location    = string.IsNullOrEmpty(txtLocation.Text) ? "" : txtLocation.Text.Trim();


            lblErrorMsg.Text = "";
            if (!ReferenceEquals(Session[Constants.SESSION_SEARCH_CRITERIA], null))
            {
                SearchCriteria searchCriteria = (SearchCriteria)Session[Constants.SESSION_SEARCH_CRITERIA];

                if (!ReferenceEquals(searchCriteria, null))
                {
                    BuildSearchCriteria(searchCriteria);
                    gvwLoc.PageIndex = searchCriteria.PageIndex;
                    if (searchCriteria.PageSize > 0)
                    {
                        gvwLoc.PageSize = searchCriteria.PageSize;
                    }

                    IEqpRepairing iequip = new EquipmentRepairEntity();
                    iequip.pk_RepairID = -1;
                    iequip.Location    = Location;
                    iequip.ContainerNo = containerNo;


                    try
                    {
                        System.Data.DataTable dt = BLL.EquipmentBLL.GetEqpRepair(_userId, iequip);
                        System.Data.DataView  dv = new System.Data.DataView(dt);
                        if (!string.IsNullOrEmpty(SortExp) && !string.IsNullOrEmpty(direction))
                        {
                            dv.Sort = SortExp + " " + direction;
                        }
                        gvwLoc.DataSource = dv;
                    }
                    catch (Exception ex)
                    {
                        gvwLoc.DataSource = null;
                        lblErrorMsg.Text  = "Error Occured.Please try again.";
                    }

                    gvwLoc.DataBind();
                }
            }
        }
Exemple #2
0
        private void SaveData(string EqEstId)
        {
            if (chkDamage.Checked || chkpOnHold.Checked)
            { // ClearControls();
            }
            else
            if (!checkContainerStatus(true))
            {
                return;
            }



            if (DisableControls() == 1 && txtAppUser.Text.Trim() == "" && (txtLabourApp.Text != "" || txtMaterialApp.Text != ""))//ddlUser.SelectedIndex == 0)
            {
                lblError.Text = "Approver name cannot be blank";
                return;
            }
            IEqpRepairing iequip = new EquipmentRepairEntity();

            iequip.pk_RepairID       = Convert.ToInt32(EqEstId);
            iequip.locId             = Convert.ToInt32(ddlLoc.SelectedValue);
            iequip.ContainerNo       = txtContainerNo.Text;
            iequip.EstimateReference = txtEstimateRef.Text;
            iequip.RepLabourBilled   = txtLabourBill.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtLabourBill.Text);
            iequip.RepLabourEst      = txtLabourEst.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtLabourEst.Text);
            iequip.RepLabourAppr     = txtLabourApp.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtLabourApp.Text);
            iequip.RepMaterialAppr   = txtMaterialApp.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtMaterialApp.Text);
            iequip.RepMaterialBilled = txtMaterialBill.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtMaterialBill.Text);
            iequip.RepMaterialEst    = txtMaterialEst.Text.Trim() == "" ? 0 : Convert.ToDecimal(txtMaterialEst.Text);
            iequip.Reason            = txtReason.Text;
            iequip.RealeasedOn       = txtReleasedOn.Text.Trim() == "" ? (Nullable <DateTime>)null : Convert.ToDateTime(txtReleasedOn.Text);
            iequip.StockReturnDate   = txtStockRetDate.Text.Trim() == "" ? (Nullable <DateTime>)null : Convert.ToDateTime(txtStockRetDate.Text);
            iequip.TransactionDate   = txtTransactionDate.Text.Trim() == "" ? (Nullable <DateTime>)null : Convert.ToDateTime(txtTransactionDate.Text);
            iequip.ProspectID        = Convert.ToInt32(ddlLine.SelectedValue);
            iequip.locId             = Convert.ToInt32(ddlLoc.SelectedValue);
            iequip.NVOCCId           = Convert.ToInt32(ddlLine.SelectedValue);
            try
            {
                iequip.fk_UserApproved = _userId;// Convert.ToInt32(txtAppUser.Text);// Convert.ToInt32(ddlUser.SelectedValue);
            }
            catch
            {
                iequip.fk_UserApproved = null;
            }

            iequip.onHold  = chkpOnHold.Checked;
            iequip.Damaged = chkDamage.Checked;


            //if (iequip.RepLabourBilled < iequip.RepLabourAppr || iequip.RepMaterialBilled < iequip.RepMaterialAppr)
            //{
            //    // GeneralFunctions.RegisterAlertScript(this, "Approved amount cannot be greater then Billable amount");
            //    lblError.Text = "Approved amount cannot be greater then Billable amount";
            //    return;
            //}

            if (iequip.RepLabourEst < iequip.RepLabourAppr || iequip.RepMaterialEst < iequip.RepMaterialAppr)
            {
                // GeneralFunctions.RegisterAlertScript(this, "Approved amount cannot be greater then Billable amount");
                lblError.Text = "Approved amount cannot be greater then Estimate amount";
                return;
            }

            bool isedit = EqEstId != "-1" ? true : false;
            int  result = EquipmentBLL.AddEditEquipEstimate(_userId, isedit, iequip);

            if (result > 0)
            {
                Response.Redirect("~/Equipment/RepairingEstimate.aspx");
            }
            else
            {
                GeneralFunctions.RegisterAlertScript(this, "Error Occured");
            }
        }
Exemple #3
0
        private void LoadData(int _userId, string EqEstId)
        {
            int intEqEstId = 0;

            if (EqEstId == "" || !Int32.TryParse(EqEstId, out intEqEstId))
            {
                return;
            }
            ClearControls();
            IEqpRepairing iequip = new EquipmentRepairEntity();

            iequip.pk_RepairID = intEqEstId;
            iequip.Location    = "";
            iequip.ContainerNo = "";
            System.Data.DataTable dt = EquipmentBLL.GetEqpRepair(_userId, iequip);


            if (!ReferenceEquals(dt, null) && dt.Rows.Count > 0)
            {
                txtContainerNo.Text     = dt.Rows[0]["ContainerNo"].ToString();
                txtEstimateRef.Text     = dt.Rows[0]["EstimateReference"].ToString();
                txtLabourBill.Text      = dt.Rows[0]["LabourBill"].ToString();
                txtLabourEst.Text       = dt.Rows[0]["LabourEst"].ToString();
                txtLabourApp.Text       = dt.Rows[0]["LabourApp"].ToString();
                txtMaterialApp.Text     = dt.Rows[0]["MaterialAppr"].ToString();
                txtMaterialBill.Text    = dt.Rows[0]["MaterialBill"].ToString();
                txtMaterialEst.Text     = dt.Rows[0]["MaterialEst"].ToString();
                txtReason.Text          = dt.Rows[0]["Reason"].ToString();
                txtReleasedOn.Text      = dt.Rows[0]["ReleasedOn"].ToString().Split(' ')[0];
                txtStockRetDate.Text    = dt.Rows[0]["StockRetDate"].ToString().Split(' ')[0];
                txtTransactionDate.Text = dt.Rows[0]["TransactionDate"].ToString().Split(' ')[0];
                ddlLine.SelectedValue   = dt.Rows[0]["pk_prospectID"].ToString();
                ddlLoc.SelectedValue    = dt.Rows[0]["pk_locId"].ToString();
                //ddlUser.SelectedValue = dt.Rows[0]["fk_UserApproved"].ToString();
                int[] adm_mgrRoles = { 1, 2, 5 };
                int   uid          = -2;
                int.TryParse(Convert.ToString(dt.Rows[0]["fk_UserApproved"]), out uid);
                System.Data.DataSet ds = UserBLL.GetUserById(uid);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtAppUser.Text       = ds.Tables[0].Rows[0]["Name"].ToString();
                    txtLabourEst.ReadOnly = true;
                    txtLabourEst.Style.Add("background-color", "#E6E6E6");
                    txtMaterialEst.ReadOnly = true;
                    txtMaterialEst.Style.Add("background-color", "#E6E6E6");
                }
                else if (Array.IndexOf(adm_mgrRoles, EMS.BLL.UserBLL.GetLoggedInUserRoleId()) > 0)
                {
                    ds = UserBLL.GetUserById(_userId);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        txtAppUser.Text = ds.Tables[0].Rows[0]["Name"].ToString();
                    }
                }
                else
                {
                    txtAppUser.Text = "";
                }

                chkpOnHold.Checked = Convert.ToBoolean(dt.Rows[0]["onHold"]);
                chkDamage.Checked  = Convert.ToBoolean(dt.Rows[0]["Damaged"]);
            }
        }