Exemplo n.º 1
0
        private void TogglePlomps(Guid CommoditydepositRequestId)
        {
            DriverInformationBLL        obj  = new DriverInformationBLL();
            List <DriverInformationBLL> list = null;

            list = obj.GetActiveDriverInformationByReceivigRequestId(CommoditydepositRequestId);
            if (list != null)
            {
                if (list.Count > 0)
                {
                    obj = list[0];
                    if (string.IsNullOrEmpty(obj.PlateNumber) == true)
                    {
                        this.txtNoPlomps.Text    = "0";
                        this.txtNoPlomps.Enabled = false;
                        this.rfNoPlomps.Enabled  = false;
                    }
                    if (string.IsNullOrEmpty(obj.TrailerPlateNumber) == true)
                    {
                        this.txtTrailerNoPlomps.Text    = "0";
                        this.txtTrailerNoPlomps.Enabled = false;
                        this.rfvTrailerNoPlomps.Enabled = false;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void SingleDriver()
        {
            List <DriverInformationBLL> listDriverInfo = null;
            DriverInformationBLL        objDriverInfo  = new DriverInformationBLL();

            if (Session["CommodityRequestId"] != null)
            {
                Guid CdrId = new Guid(Session["CommodityRequestId"].ToString());
                listDriverInfo = objDriverInfo.GetActiveDriverInformationByReceivigRequestId(CdrId);
                if (listDriverInfo == null)
                {
                    this.btnComplete.Enabled = false;
                }
                else
                {
                    if (listDriverInfo.Count <= 0)
                    {
                        this.btnSave.Enabled = true;
                    }
                    else if (listDriverInfo.Count > 0)
                    {
                        this.btnSave.Enabled = false;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void rptSamplingResult_DataInitialize(object sender, EventArgs e)
        {
            SamplingResultBLL objSamplingResult = null;

            if (HttpContext.Current.Session["SamplingResultCode"] != null)
            {
                string Code = HttpContext.Current.Session["SamplingResultCode"].ToString();
                objSamplingResult = new SamplingResultBLL();
                objSamplingResult = objSamplingResult.GetSamplingResultBySamplingResultCode(Code);
            }
            else
            {
                throw new Exception("Session expired");
            }
            if (objSamplingResult != null)
            {
                this.txtCode.Text   = objSamplingResult.SamplingResultCode;
                this.txtNoBags.Text = objSamplingResult.NumberOfBags.ToString();
                SamplingBLL objSampling = new SamplingBLL();
                objSampling = objSampling.GetSampleDetail(objSamplingResult.SamplingId);
                this.txtDateSampled.Text   = objSampling.GeneratedTimeStamp.ToString("dd MMM-yyyy");
                this.txtDateGenerated.Text = DateTime.Now.ToString("dd MMM-yyyy");
                DriverInformationBLL        objDriver  = new DriverInformationBLL();
                List <DriverInformationBLL> listDriver = objDriver.GetActiveDriverInformationByReceivigRequestId(objSampling.ReceivigRequestId);
                if (listDriver != null)
                {
                    this.txtPlateNo.Text        = listDriver[0].TrailerPlateNumber.ToString();
                    this.txtTrailerPlateNo.Text = listDriver[0].TrailerPlateNumber.ToString();
                }
            }
            this.txtDateGenerated.Text = DateTime.Now.ToString("dd MMM-yyyy");
        }
Exemplo n.º 4
0
        public static List <DriverInformationBLL> GetActiveDriverInformationByReceivigRequestId(Guid ReceivigRequestId)
        {
            List <DriverInformationBLL> list = null;
            string strSql = "spGetDriverInformationByReceivigRequestId";

            SqlParameter[] arPar = new SqlParameter[1];
            arPar[0]       = new SqlParameter("@ReceivigRequestId", SqlDbType.UniqueIdentifier);
            arPar[0].Value = ReceivigRequestId;
            DataSet       dsDriverInformation = null;
            SqlConnection conn = null;

            try
            {
                conn = Connection.getConnection();
                dsDriverInformation = SqlHelper.ExecuteDataset(conn, CommandType.StoredProcedure, strSql, arPar);
                if (dsDriverInformation.Tables[0].Rows.Count > 0)
                {
                    list = new List <DriverInformationBLL>();
                    for (int i = 0; i < dsDriverInformation.Tables[0].Rows.Count; i++)
                    {
                        DriverInformationBLL o = new DriverInformationBLL();
                        o.Id = new Guid(dsDriverInformation.Tables[0].Rows[i]["Id"].ToString());
                        o.ReceivigRequestId  = new Guid(dsDriverInformation.Tables[0].Rows[i]["ReceivingRequestId"].ToString());
                        o.PlateNumber        = dsDriverInformation.Tables[0].Rows[i]["PlateNumber"].ToString();
                        o.TrailerPlateNumber = dsDriverInformation.Tables[0].Rows[i]["TrailerPlateNumber"].ToString();
                        o.Status             = Convert.ToInt32(dsDriverInformation.Tables[0].Rows[i]["Status"].ToString());
                        o.DriverName         = dsDriverInformation.Tables[0].Rows[i]["DriverName"].ToString();
                        o.LicenseNumber      = dsDriverInformation.Tables[0].Rows[i]["LicenseNumber"].ToString();
                        o.LicenseIssuedPlace = dsDriverInformation.Tables[0].Rows[i]["LicenseIssuedPlace"].ToString();

                        if (o.Status == 2 || o.Status == 1)
                        {
                            list.Add(o);
                        }
                    }
                    return(list);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
Exemplo n.º 5
0
        public Guid InsertDriverInformation(DriverInformationBLL ObjDriverInfo, SqlTransaction tran)
        {
            string strSql = "spInsertDriverInformation";

            SqlParameter[] arPar = new SqlParameter[9];

            arPar[0]       = new SqlParameter("@ReceivigRequestId", SqlDbType.UniqueIdentifier);
            arPar[0].Value = ObjDriverInfo.ReceivigRequestId;

            arPar[1]       = new SqlParameter("@DriverName", SqlDbType.NVarChar, 50);
            arPar[1].Value = ObjDriverInfo.DriverName;

            arPar[2]       = new SqlParameter("@LicenseNumber", SqlDbType.NVarChar, 50);
            arPar[2].Value = ObjDriverInfo.LicenseNumber;

            arPar[3]       = new SqlParameter("@LicenseIssuedPlace", SqlDbType.NVarChar, 50);
            arPar[3].Value = ObjDriverInfo.LicenseIssuedPlace;

            arPar[4]       = new SqlParameter("@PlateNumber", SqlDbType.NVarChar, 50);
            arPar[4].Value = ObjDriverInfo.PlateNumber;

            arPar[5]       = new SqlParameter("TrailerPlateNumber", SqlDbType.NVarChar, 50);
            arPar[5].Value = ObjDriverInfo.TrailerPlateNumber;

            arPar[6]       = new SqlParameter("@CreatedBy", SqlDbType.UniqueIdentifier);
            arPar[6].Value = ObjDriverInfo.CreatedBy;


            arPar[7]       = new SqlParameter("@Status", SqlDbType.Int);
            arPar[7].Value = 1;

            arPar[8]           = new SqlParameter("@DriverInformationId", SqlDbType.UniqueIdentifier);
            arPar[8].Direction = ParameterDirection.Output;



            int AffectedRows;

            try
            {
                AffectedRows = SqlHelper.ExecuteNonQuery(tran, CommandType.StoredProcedure, strSql, arPar);
                Guid DriverInformationId = Guid.Empty;
                DriverInformationId = new Guid(arPar[8].Value.ToString());
                return(DriverInformationId);
            }
            catch (Exception e)
            {
                throw new Exception("Unable to Insert Data", e);
            }
        }
Exemplo n.º 6
0
        private void BindData(Guid Id)
        {
            ScalingBLL obj = new ScalingBLL();

            obj = obj.GetById(Id);
            if (obj != null)
            {
                if (obj.Id != null)
                {
                    this.hfId.Value = obj.Id.ToString();
                }
                if (obj.ScaleTicketNumber != "")
                {
                    this.txtScaleTicket.Text = obj.ScaleTicketNumber.ToString();
                }
                if (obj.DateWeighed != null)
                {
                    this.txtDateWeighed.Text = obj.DateWeighed.ToString();
                }
                this.cboWeigher.SelectedValue = obj.WeigherId.ToString();
                this.txtGrossTruckWeight.Text = obj.GrossWeightWithTruck.ToString();

                this.txtGrossWeoght.Text = obj.GrossWeight.ToString();
                this.txtTruckWeight.Text = obj.TruckWeight.ToString();

                this.txtRemark.Text          = obj.Remark;
                this.cboStatus.SelectedValue = ((int)obj.Status).ToString();
                DriverInformationBLL objDriver = new DriverInformationBLL();
                if (obj.DriverInformationId != null)
                {
                    objDriver = objDriver.GetById(obj.DriverInformationId);
                    if (objDriver != null)
                    {
                        this.lblPlateNo.Text   = objDriver.PlateNumber;
                        this.lblTrailerNo.Text = objDriver.TrailerPlateNumber;
                    }
                }
                bool   hasGRN = false;
                GRNBLL objGRN = new GRNBLL();
                hasGRN = objGRN.HasGRN("tblScaling", obj.Id);
                if (hasGRN == true)
                {
                    this.btnAdd.Enabled  = false;
                    this.lblMessage.Text = "You can't update this Data because a GRN has already been Created for it.";
                }
            }
        }
Exemplo n.º 7
0
        private void rptSampleTicketCoffee_DataInitialize(object sender, EventArgs e)
        {
            this.txtDateGenerated.Text = DateTime.Today.ToString("dd MMM-yyyy");

            //Load Sample ticket with data.
            if (HttpContext.Current.Session["Sample"] != null)
            {
                SamplingBLL objSampling = new SamplingBLL();
                objSampling = (SamplingBLL)HttpContext.Current.Session["Sample"];
                objSampling = objSampling.GetSampleDetail(objSampling.Id);
                this.txtDateSampled.Text = objSampling.GeneratedTimeStamp.ToString("dd MMM-yyyy");
                this.txtCode.Text        = objSampling.SampleCode.ToString();
                EmployeeAttendanceBLL objEmployee = new EmployeeAttendanceBLL();


                this.txtSamplerName.Text = UserRightBLL.GetUserNameByUserId(objSampling._sampler.SamplerId);
                VoucherInformationBLL objVoucher = new VoucherInformationBLL();
                objVoucher = objVoucher.GetVoucherInformationByCommodityDepositRequestId(objSampling.ReceivigRequestId);
                if (objVoucher != null)
                {
                    this.txtNoBags.Text       = objVoucher.NumberofBags.ToString();
                    this.txtPlompTruck.Text   = objVoucher.NumberOfPlomps.ToString();
                    this.txtPlompTrailer.Text = objVoucher.NumberOfPlompsTrailer.ToString();
                }
                //Get Driver information.
                List <DriverInformationBLL> list = new List <DriverInformationBLL>();
                DriverInformationBLL        obj  = new DriverInformationBLL();
                list = obj.GetActiveDriverInformationByReceivigRequestId(objSampling.ReceivigRequestId);
                if (list != null)
                {
                    if (list.Count == 1)
                    {
                        obj = list[0];
                        this.txtPlateNo.Text        = obj.PlateNumber.ToString();
                        this.txtTrailerPlateNo.Text = obj.TrailerPlateNumber.ToString();
                    }
                }
            }
            HttpContext.Current.Session["Sample"]  = null;
            HttpContext.Current.Session["Sampler"] = null;
        }
Exemplo n.º 8
0
        private void rptGRN_ReportStart(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["GRNIDPrint"] == null)
            {
                throw new Exception("Session expired");
            }
            Guid GRNId = Guid.Empty;

            GRNId = new Guid(HttpContext.Current.Session["GRNIDPrint"].ToString());
            Guid   GradingId = Guid.Empty;
            GRNBLL objGRN    = new GRNBLL();

            objGRN              = objGRN.GetbyGRN_Number(GRNId);
            GradingId           = objGRN.GradingId;
            this.lblGRN_No.Text = objGRN.GRN_Number;
            this.lblClient.Text = ClientBLL.GetClinetNameById(objGRN.ClientId);

            this.lblCommodityGrade.Text   = CommodityGradeBLL.GetCommodityGradeNameById(objGRN.CommodityGradeId);
            this.lblWarehouse.Text        = WarehouseBLL.GetWarehouseNameById(objGRN.WarehouseId);
            this.lblOriginalQuantity.Text = objGRN.OriginalQuantity.ToString();
            this.lblNetWeight.Text        = objGRN.NetWeight.ToString();
            this.lblDateDeposited.Text    = objGRN.DateDeposited.ToShortDateString();
            this.lblTimeDeposited.Text    = objGRN.DateDeposited.ToShortTimeString();
            this.lblNoBags.Text           = objGRN.TotalNumberOfBags.ToString();
            //Bag Type
            BagTypeBLL objBt = new BagTypeBLL();

            objBt.GetBagTypeById(objGRN.BagTypeId);
            lblBagType.Text = objBt.BagTypeName;

            //Driver Information

            List <DriverInformationBLL> list  = null;
            DriverInformationBLL        objDI = new DriverInformationBLL();

            list = objDI.GetActiveDriverInformationByReceivigRequestId(objGRN.CommodityRecivingId);
            if (list != null)
            {
                string driverName          = "";
                string plateNo             = "";
                string driverLicense       = "";
                string licensceIssuedPlace = "";
                foreach (DriverInformationBLL o in list)
                {
                    if (driverName == "")
                    {
                        driverName = o.DriverName;
                    }
                    else
                    {
                        driverName += "," + o.DriverName;
                    }
                    if (plateNo == "")
                    {
                        if (String.IsNullOrEmpty(o.TrailerPlateNumber) != true)
                        {
                            plateNo = o.PlateNumber + "-" + o.TrailerPlateNumber;
                        }
                        else
                        {
                            plateNo = o.PlateNumber;
                        }
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(o.TrailerPlateNumber) != true)
                        {
                            plateNo += " , " + o.PlateNumber + "-" + o.TrailerPlateNumber;
                        }
                        else
                        {
                            plateNo += " , " + o.PlateNumber;
                        }
                    }
                    if (driverLicense == "")
                    {
                        driverLicense = o.LicenseNumber;
                    }
                    else
                    {
                        driverLicense += " , " + o.LicenseNumber;
                    }
                    if (licensceIssuedPlace == "")
                    {
                        licensceIssuedPlace = o.LicenseIssuedPlace;
                    }
                    else
                    {
                        licensceIssuedPlace += " , " + o.LicenseIssuedPlace;
                    }
                }
                this.lblDriverName.Text    = driverName;
                this.lblPlateNo.Text       = plateNo;
                this.lblDriverLicense.Text = driverLicense;
                this.lblPlaceIssued.Text   = licensceIssuedPlace;
            }
            // Scaling
            ScalingBLL objScaling = new ScalingBLL();

            objScaling = objScaling.GetById(objGRN.ScalingId);
            if (objScaling != null)
            {
                if (objScaling.WeigherId != null)
                {
                    try
                    {
                        this.lblWeigherName.Text = UserRightBLL.GetUserNameByUserId(objScaling.WeigherId);
                    }
                    catch
                    {
                    }
                }
            }
            // Sampler
            SamplerBLL objSampler = new SamplerBLL();

            objSampler = objSampler.GetActiveSamplingSupBySamplingId(objGRN.SamplingTicketId);
            if (objSampler != null)
            {
                this.lblSampler.Text = UserRightBLL.GetUserNameByUserId(objSampler.SamplerId);
            }
            //Graders
            GradingByBLL objGrader = new GradingByBLL();

            this.lblGrader.Text = objGrader.GetSupGraderNameByGradingId(objGRN.GradingId);

            if (objGRN.ApprovedBy != null)
            {
                try
                {
                    this.lblApprovedBy.Text = UserRightBLL.GetUserNameByUserId(objGRN.ApprovedBy);
                }
                catch
                {
                }
            }
            if (objGRN.ApprovedTimeStamp != null)
            {
                this.lblDateAproved.Text = objGRN.ApprovedTimeStamp.ToShortDateString();
            }
            rpt   = new rptGrading(GradingId);
            rptGS = new rptGRNService(GRNId);
            this.txtDateGenerated.Text = DateTime.Now.ToString();
            ScalingBLL objSacling = new ScalingBLL();

            objSacling = objSacling.GetById(objGRN.ScalingId);
            if (objSacling != null)
            {
                this.lblScaleTicketNo.Text = objSacling.ScaleTicketNumber;
            }

            this.subReport1.Report = rpt;
            this.subReport2.Report = this.rptGS;
        }
Exemplo n.º 9
0
        public bool UpdateDriverInformation(DriverInformationBLL ObjDriverInfo, SqlTransaction conn)
        {
            string strSql = "spUpdateDriverInformation";

            SqlParameter[] arPar = new SqlParameter[9];

            arPar[0]       = new SqlParameter("@Id", SqlDbType.UniqueIdentifier);
            arPar[0].Value = ObjDriverInfo.Id;

            arPar[1]       = new SqlParameter("@DriverName", SqlDbType.NVarChar, 50);
            arPar[1].Value = ObjDriverInfo.DriverName;

            arPar[2]       = new SqlParameter("@LicenseNumber", SqlDbType.NVarChar, 50);
            arPar[2].Value = ObjDriverInfo.LicenseNumber;

            arPar[3]       = new SqlParameter("@LicenseIssuedPlace", SqlDbType.NVarChar, 50);
            arPar[3].Value = ObjDriverInfo.LicenseIssuedPlace;

            arPar[4] = new SqlParameter("@PlateNumber", SqlDbType.NVarChar, 50);
            if (ObjDriverInfo.PlateNumber == null)
            {
                //arPar[4].Value = DBNull ;
            }
            else
            {
                arPar[4].Value = ObjDriverInfo.PlateNumber;
            }

            arPar[5] = new SqlParameter("@TrailerPlateNumber", SqlDbType.NVarChar, 50);
            if (ObjDriverInfo.TrailerPlateNumber == null)
            {
                //arPar[5].Value = DBNull;
            }
            else
            {
                arPar[5].Value = ObjDriverInfo.TrailerPlateNumber;
            }

            arPar[6]       = new SqlParameter("@LastModifiedBy", SqlDbType.UniqueIdentifier);
            arPar[6].Value = ObjDriverInfo.LastModifiedBy;

            arPar[7] = new SqlParameter("@Remark", SqlDbType.Text);

            arPar[8]       = new SqlParameter("@Status", SqlDbType.Int);
            arPar[8].Value = ObjDriverInfo.Status;

            if (ObjDriverInfo.Remark == null)
            {
                arPar[7].Value = String.Empty;;
            }
            else
            {
                arPar[7].Value = ObjDriverInfo.Remark;
            }
            int AffectedRows = 0;

            try
            {
                AffectedRows = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, strSql, arPar);
            }
            catch (Exception e)
            {
                ErrorLogger.Log(e);
                // trans.Rollback();
                AffectedRows = 0;
            }
            return(AffectedRows == 1);
        }
Exemplo n.º 10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.lblMessage.Text = "";
            bool isSaved = false;
            // Save the Driver Information.
            DriverInformation objDriverInfo = new DriverInformation();
            Guid CommodityDepositRequestId  = new Guid(this.CommodityDepositRequestId.Value.ToString());

            Guid CreatedBy = UserBLL.GetCurrentUser();

            if (this.txtRemark.Text == null)
            {
                this.txtRemark.Text = String.Empty;
            }
            Guid TruckRegisterId = Guid.Empty;


            if (txtPlateNo.Text != "")
            {
                //Registering Truck
                TruckRegisterBLL objTruckRegister = new TruckRegisterBLL();
                objTruckRegister.IsTrailer = false;
                if (cboModelYear.SelectedValue.ToString() != "")
                {
                    objTruckRegister.TruckModelYearId = new Guid(cboModelYear.SelectedValue.ToString());
                }
                else
                {
                    this.lblMessage.Text = "Please Select Truck Model Year.";
                    return;
                }
                objTruckRegister.TruckNumber = txtPlateNo.Text;
                objTruckRegister.Status      = TruckStatus.Active;
                objTruckRegister.Add();
            }
            if (txtTrailerPlateNo.Text != "")
            {
                //Registering Truck
                TruckRegisterBLL objTrailerTruckRegister = new TruckRegisterBLL();
                objTrailerTruckRegister.IsTrailer = true;
                if (cboTrailerModelYear.SelectedValue.ToString() != "")
                {
                    objTrailerTruckRegister.TruckModelYearId = new Guid(cboTrailerModelYear.SelectedValue.ToString());
                }
                else
                {
                    this.lblMessage.Text = "Please Select Trailer Model Year.";
                    return;
                }
                objTrailerTruckRegister.TruckNumber = txtTrailerPlateNo.Text;
                objTrailerTruckRegister.Status      = TruckStatus.Active;
                objTrailerTruckRegister.Add();
            }


            DriverInformationBLL obj = new DriverInformationBLL(CommodityDepositRequestId, this.txtDriverName.Text,
                                                                this.txtLicenseNo.Text, this.txtPlaceIssued.Text, this.txtPlateNo.Text, this.txtTrailerPlateNo.Text,
                                                                1, this.txtRemark.Text, CreatedBy);

            try
            {
                isSaved = obj.SaveDriverInformation();
            }
            catch (DuplicateDriverInformationException ex)
            {
                this.lblMessage.Text = ex.msg;
                return;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (isSaved == true)
            {
                this.lblMessage.Text = "Record Added Successfully";
                this.btnSave.Enabled = false;
                ClearForm();
                this.CommodityDepositRequestId.Value = CommodityDepositRequestId.ToString();
                BindData(CommodityDepositRequestId);
            }
            else
            {
                this.lblMessage.Text = "Unable to Add the data please check the form and try agian.";
            }
            ToggleNext();
        }
Exemplo n.º 11
0
        protected void btnComplete_Click(object sender, EventArgs e)
        {
            this.lblMessage.Text = "";
            Nullable <Guid> Id            = null;
            string          TransactionNo = "";

            TransactionNo = Request.QueryString["TranNo"];
            if (string.IsNullOrEmpty(TransactionNo))
            {
                return;
            }

            if (Session["CommodityRequestId"] == null)
            {
                CommodityDepositeRequestBLL objCDR = new CommodityDepositeRequestBLL();
                objCDR = objCDR.GetCommodityDepositeDetailByTrackingNo(TransactionNo);
                Id     = objCDR.Id;
                Session["CommodityRequestId"] = Id.ToString();
            }
            else
            {
                Id = new Guid(Session["CommodityRequestId"].ToString());
            }
            // if the Step is in Driver Info.
            //if (WFTransaction.GetMessage(TransactionNo) == "AddDriverInformation")
            //{
            //    WFTransaction.WorkFlowManager(TransactionNo);
            //}
            //Check if Driver Information is Added.
            List <DriverInformationBLL> listDriverInfo = null;
            DriverInformationBLL        objDriverInfo  = new DriverInformationBLL();

            if (Session["CommodityRequestId"] != null)
            {
                Guid CdrId = new Guid(Session["CommodityRequestId"].ToString());
                listDriverInfo = objDriverInfo.GetActiveDriverInformationByReceivigRequestId(CdrId);
                if (listDriverInfo == null)
                {
                    this.btnComplete.Enabled = false;
                }
                else
                {
                    if (listDriverInfo.Count <= 0)
                    {
                        this.btnComplete.Enabled = false;
                    }
                    else
                    {
                        if (Id != null)
                        {
                            ECXWF.CMessage msg = (ECXWF.CMessage)HttpContext.Current.Session["msg"];
                            if (msg != null)
                            {
                                if (msg.Name == "AddDriverInformation")
                                {
                                    WFTransaction.WorkFlowManager(TransactionNo);
                                    Response.Redirect("ListInbox.aspx");
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
        protected void gvDriverInformation_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            this.lblMessage.Text = "";
            Guid        DriverInformationId;
            string      DriverName, LicenseNo, LicenseIssuedPlace, PlateNumber, TrailerPlateNo, Remark;
            int         Status;
            bool        isSaved = false;
            GridViewRow row     = gvDriverInformation.Rows[e.RowIndex];

            if (row != null)
            {
                TextBox      txtDriverName     = (TextBox)row.FindControl("txtEditDriverName");
                Label        lblId             = (Label)row.FindControl("lblId");
                TextBox      txtLicenseNo      = (TextBox)row.FindControl("txtLicenseNumber");
                TextBox      txtPlaceIssued    = (TextBox)row.FindControl("txtLicenseIssuedPlace");
                TextBox      txtPlateNumber    = (TextBox)row.FindControl("txtPlateNumber");
                TextBox      txtTrailerPlateNo = (TextBox)row.FindControl("txtTrailerPlateNumber");
                TextBox      txtRemark         = (TextBox)row.FindControl("txtRemark");
                DropDownList cboStatus         = (DropDownList)row.FindControl("cboStatusEdit");

                if (lblId != null)
                {
                    DriverInformationId = new Guid(lblId.Text.ToString());
                }
                else
                {
                    lblMessage.Text = "An error occured can you please try agin.If the error persists contact the administrator.";
                    return;
                }
                if (txtDriverName != null)
                {
                    DriverName = txtDriverName.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find Driver Name";
                    return;
                }
                if (txtLicenseNo != null)
                {
                    LicenseNo = txtLicenseNo.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find License Number.";
                    return;
                }
                if (txtPlaceIssued != null)
                {
                    LicenseIssuedPlace = txtPlaceIssued.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find License Place Issued.";
                    return;
                }
                if (txtPlateNo != null)
                {
                    PlateNumber = txtPlateNumber.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find License Plate Number.";
                    return;
                }
                if (txtTrailerPlateNo != null)
                {
                    TrailerPlateNo = txtTrailerPlateNo.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find Trailer Plate Number.";
                    return;
                }
                if (txtRemark != null)
                {
                    Remark = txtRemark.Text;
                }
                else
                {
                    lblMessage.Text = "Can not find Remark.";
                    return;
                }
                if (cboStatus != null)
                {
                    Status = Convert.ToInt32(cboStatus.SelectedValue.ToString());
                }
                else
                {
                    lblMessage.Text = "Can not find Status.";
                    return;
                }
                if (Status == 0)
                {
                    if (Remark == "" || Remark == String.Empty)
                    {
                        lblMessage.Text = "Please provide Cancellation reason.";
                        return;
                    }
                }
                DriverInformationBLL objEdit = new DriverInformationBLL();
                objEdit = objEdit.GetById(DriverInformationId);
                DriverInformationBLL obj = new DriverInformationBLL();
                obj.ReceivigRequestId = new Guid(this.CommodityDepositRequestId.Value.ToString());
                obj.Id                 = DriverInformationId;
                obj.DriverName         = DriverName;
                obj.LicenseNumber      = LicenseNo;
                obj.LicenseIssuedPlace = LicenseIssuedPlace;
                obj.PlateNumber        = PlateNumber;
                obj.TrailerPlateNumber = TrailerPlateNo;
                obj.Remark             = Remark;
                obj.Status             = Status;
                try
                {
                    isSaved = obj.EditDriverInformation(objEdit);
                    if (isSaved == true)
                    {
                        this.lblMessage.Text          = "Data updated Successfully.";
                        gvDriverInformation.EditIndex = -1;


                        BindData(obj.ReceivigRequestId);
                    }
                    else
                    {
                        this.lblMessage.Text          = "Unable to update data.Please try agian.";
                        gvDriverInformation.EditIndex = -1;
                        BindData(obj.ReceivigRequestId);
                    }
                }
                catch (GRNNotOnUpdateStatus exGRN)
                {
                    this.lblMessage.Text = exGRN.msg;
                    return;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            ToggleNext();
            SingleDriver();
        }
Exemplo n.º 13
0
        private void LoadTruckInformation()
        {
            if (this.cboGradingCode.SelectedValue.ToString() == "")
            {
                this.lblmsg.Text = "Please select Tracking No.";
                this.cboGradingCode.SelectedIndex = -1;
                return;
            }
            string str = this.cboGradingCode.SelectedValue.ToString();

            string[] temp = new string[2];
            temp = str.Split('/');
            if (temp[0] == "" || temp[0] == null)
            {
                this.lblmsg.Text = "Please try agian.";
                this.cboGradingCode.SelectedIndex = -1;
                return;
            }
            Guid ReceivigRequestId;

            try
            {
                ReceivigRequestId = new Guid(temp[0].ToString());
            }
            catch
            {
                this.lblmsg.Text = "Please try agian.";
                this.cboGradingCode.SelectedIndex = -1;
                return;
            }
            try
            {
                this.hfGradingResultId.Value = temp[1].ToString();
            }
            catch
            {
                this.lblmsg.Text = "An error occured, please try agian.";
                this.cboGradingCode.SelectedIndex = -1;
                return;
            }
            this.hfReceivigRequestId.Value = ReceivigRequestId.ToString();
            List <DriverInformationBLL> list     = new List <DriverInformationBLL>();
            DriverInformationBLL        objTruck = new DriverInformationBLL();

            list = objTruck.GetActiveDriverInformationByReceivigRequestId(ReceivigRequestId);
            this.gvDriverInformation.DataSource = list;
            this.gvDriverInformation.DataBind();
            //Get detail gradingResult
            GradingResultBLL objGradingResult = new GradingResultBLL();

            objGradingResult = objGradingResult.GetGradingResultById(new Guid(temp[1].ToString()));
            UnloadingBLL objUnloading = new UnloadingBLL();

            objUnloading = objUnloading.GetApprovedUnloadingByGradingResultId(objGradingResult.ID);
            if (objUnloading != null)
            {
                this.lblDateUnloaded.Text      = objUnloading.DateDeposited.ToShortDateString();
                this.cmpSampGen.ValueToCompare = objUnloading.DateDeposited.ToShortDateString();
            }
            this.hfTrackingNo.Value = objGradingResult.TrackingNo;
        }