Example #1
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"]);
            }
        }