Beispiel #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            bool     isSaved = false;
            bool     ca      = false;
            DateTime cd;

            try
            {
                ca = Convert.ToBoolean(int.Parse(this.cboClientAccpted.SelectedValue.ToString()));
            }
            catch
            {
                this.lblmsg.Text = "please select client Response";
                this.cboClientAccpted.Focus();
                return;
            }
            cd = DateTime.Parse(this.txtClientAcceptedTimeStamp.Text);
            GRNBLL obj           = new GRNBLL();
            string TransactionNo = "";

            TransactionNo = Request.QueryString["TranNo"];
            GRNStatus prevStatus = (GRNStatus)(int.Parse(this.hfStatus.Value));

            isSaved = obj.ClientAcceptance(this.lblGRN.Text, cd, ca, TransactionNo, prevStatus);
            if (isSaved == true)
            {
                Response.Redirect("ListInbox.aspx");
            }
            else
            {
                this.lblmsg.Text = "Unable to process the request";
            }
        }
Beispiel #2
0
        public bool CancelGRN(Guid GRNId, string TrackingNo, RequestforApprovedGRNCancelationStatus status)
        {
            bool   isSaved = false;
            GRNBLL objGRN  = new GRNBLL();

            objGRN = objGRN.GetbyGRN_Number(GRNId);
            GRNStatus GRNstatus = (GRNStatus)objGRN.Status;

            if (status == RequestforApprovedGRNCancelationStatus.Cancelled)
            {
                GRNstatus = GRNStatus.Cancelled;
            }
            if (objGRN != null)
            {
                if (GRNstatus == GRNStatus.Cancelled)
                {
                    isSaved = objGRN.Update(objGRN.GRN_Number, GRNstatus, objGRN, TrackingNo, DateTime.Now);
                }
                if (isSaved == true)
                {
                    ECXWF.CMessage mess = WFTransaction.Request(TrackingNo);
                    WFTransaction.WorkFlowManager(TrackingNo, mess);
                    isSaved = true;
                }
            }
            else
            {
                throw new Exception("Unable to find GRN");
            }
            return(isSaved);
        }
Beispiel #3
0
        /// <summary>
        /// Populates existing information for update purpose, if it is text box then it fills the value
        /// if it is dropdown list then it chooses from one of the alternatives supplied by FillControls() method
        /// </summary>
        private void PopulateExistingData()
        {
            //if (theArrival.IsNew) return;
            GRNStatusNew GRNStatus;

            GRNStatusNew.TryParse(theArrival.GRNStatus.ToString(), out GRNStatus);
            if (GRNStatus == GRNStatusNew.New || GRNStatus == GRNStatusNew.NotCreated)
            {
                btnSave.Enabled = true;
            }
            else
            {
                btnSave.Enabled = false;
                btnSave.ToolTip = "Can't Update Arrival because this step is at " + GRNStatus.ToString() + " Stage";
            }
            if (theArrival.WarehouseID != WarehouseBLL.CurrentWarehouse.WarehouseId)
            {
                Response.Redirect("ErrorPage.aspx");
            }
            try
            {
                lblClient.Text             = theArrival.ClientName;
                lblWarehouse.Text          = WarehouseBLL.CurrentWarehouse.WarehouseName;
                isNonTruck.Checked         = theArrival.IsNonTruck;
                cboCommodity.SelectedValue = theArrival.CommodityID.ToString();
                //chkIsSourceDetermined.Checked = theArrival.IsLocationKnown;
                if (!theArrival.IsLocationKnown)
                {
                    cboRegion.SelectedValue = Guid.Empty.ToString();
                }
                else
                {
                    LookupValue lv = SimpleLookup.Lookup(LookupTypeEnum.Woredas).GetDictionary()[theArrival.WoredaID];
                    cboRegion.SelectedValue = lv.RegionID.ToString();
                    cboRegion_SelectedIndexChanged(this, EventArgs.Empty);
                    cboZone.SelectedValue = lv.ZoneID.ToString();
                    cboZone_SelectedIndexChanged(this, EventArgs.Empty);
                    cboWoreda.SelectedValue = theArrival.WoredaID.ToString();
                    txtSpecificArea.Text    = theArrival.SpecificArea;
                }
                cboProductionYear.SelectedValue = theArrival.ProductionYear.ToString();
                txtProcessingCenter.Text        = theArrival.ProcessingCenter;
                txtNumberOfBags.Text            = theArrival.NumberofBags.ToString() == "0" ? "" : theArrival.NumberofBags.ToString();
                txtWeight.Text = theArrival.VoucherWeight.ToString() == "0" ? "" : theArrival.VoucherWeight.ToString();

                if ("1/1/1901" == theArrival.DateTimeReceived.ToShortDateString() || theArrival.DateTimeReceived.ToShortDateString() == "1/1/0001")
                {
                    txtArrivalDate.Text = "";
                    txtTimeArrival.Text = "";
                }
                else
                {
                    txtArrivalDate.Text = theArrival.DateTimeReceived.ToShortDateString();
                    txtTimeArrival.Text = theArrival.DateTimeReceived.ToShortTimeString();
                }
                txtRemark.Text = theArrival.Remark;
                if (!theArrival.IsNonTruck)
                {
                    chkIsTruckInCompound.Checked = theArrival.IsTruckInCompound;
                    txtDriverName.Text           = theArrival.DriverName;
                    txtLicenseNo.Text            = theArrival.LicenseNumber;
                    txtPlaceIssued.Text          = theArrival.LicenseIssuedPlace;
                    txtPlateNo.Text         = theArrival.TruckPlateNumber;
                    txtTrailerPlateNo.Text  = theArrival.TrailerPlateNumber;
                    txtNoPlomps.Text        = theArrival.VoucherNumberOfPlomps.ToString() == "0" ? "" : theArrival.VoucherNumberOfPlomps.ToString();
                    txtTrailerNoPlomps.Text = theArrival.VoucherNumberOfPlompsTrailer.ToString() == "0" ? "" : theArrival.VoucherNumberOfPlompsTrailer.ToString();
                }
                txtVoucherNo.Text   = theArrival.VoucherNumber;
                hdnHasVoucher.Value = theArrival.HasVoucher.ToString();
                //chkIsBiProduct.Checked = theArrival.IsBiProduct;
                if (Guid.Empty == theArrival.VoucherCommodityTypeID || string.IsNullOrEmpty(theArrival.VoucherCommodityTypeID.ToString()))
                {
                    cboCommodityType.SelectedIndex = 0;
                    cboCommodityType.Enabled       = false;
                }
                else
                {
                    cboCommodityType.SelectedValue = theArrival.VoucherCommodityTypeID.ToString();
                }
            }
            catch (Exception ex)
            {
                //lblMessage.Text = "Failed to populate existing data!";

                Messages.SetMessage("Existing data cannot be retrieved.  Please try again.", WarehouseApplication.Messages.MessageType.Error);
            }
        }
Beispiel #4
0
        public bool Update(string GRN_number, GRNStatus Status, GRNBLL objGRN, string TrackingNo, DateTime ManagerApprovedDateTime)
        {
            bool           isSaved = false;
            SqlTransaction trans;
            SqlConnection  conn = new SqlConnection();

            conn  = Connection.getConnection();
            trans = conn.BeginTransaction();
            GRNStatus PreviousStatus;

            PreviousStatus = (GRNStatus)objGRN.Status;
            if (objGRN == null)
            {
                throw new Exception("Unable to Load GRN Data");
            }
            else
            {
                if (objGRN.Id == null || objGRN.Id == Guid.Empty)
                {
                    throw new Exception("Invalid Grading Information ");
                }
            }
            GradingBLL objGrading = new GradingBLL();

            objGrading            = objGrading.GetById(objGRN.GradingId);
            objGrading.TrackingNo = TrackingNo;
            if (Status != GRNStatus.Cancelled)
            {
                if (objGrading == null)
                {
                    throw new Exception("Unable to Load GRN Data");
                }
                else
                {
                    if (objGrading.TrackingNo == "")
                    {
                        throw new Exception("Unable to Load GRN Data");
                    }
                    else
                    {
                        TrackingNo = objGrading.TrackingNo;
                    }
                }
            }

            try
            {
                if (Status == GRNStatus.ManagerApproved)
                {
                    isSaved = GRNDAL.SetGRNStatus(GRN_number, Status, trans, ManagerApprovedDateTime);
                    if (isSaved == true)
                    {
                        int           At     = -1;
                        AuditTrailBLL objAt  = new AuditTrailBLL();
                        string        oldVal = "(GRNNo-" + GRN_number + ") , (Status-" + PreviousStatus.ToString() + ")";
                        string        NewVal = "(GRNNo-" + GRN_number + ") , (Status-" + Status.ToString() + ")";
                        At = objAt.saveAuditTrailStringFormat(oldVal, NewVal, WFStepName.EditGRN.ToString(), UserBLL.GetCurrentUser(), "Change GRN Status");
                        if (At == 1)
                        {
                            WarehouseRecieptBLL objWarehouseReciept = new WarehouseRecieptBLL(objGRN);

                            if (objWarehouseReciept.Save() == true)
                            {
                                WFTransaction.WorkFlowManager(TrackingNo);
                                isSaved = true;
                            }
                            else
                            {
                                isSaved = false;
                            }
                        }
                        else
                        {
                            isSaved = false;
                        }
                    }
                    else
                    {
                        isSaved = false;
                    }
                }
                else if (Status == GRNStatus.Cancelled)
                {
                    //Canceling Update
                    isSaved = false;
                    isSaved = GRNDAL.SetGRNStatus(GRN_number, Status, trans, ManagerApprovedDateTime);



                    if (isSaved == true)
                    {
                        int           At     = -1;
                        AuditTrailBLL objAt  = new AuditTrailBLL();
                        string        oldVal = "(GRNNo-" + GRN_number + ") , (Status-" + PreviousStatus.ToString() + ")";
                        string        NewVal = "(GRNNo-" + GRN_number + ") , (Status-" + Status.ToString() + ")";
                        At = objAt.saveAuditTrailStringFormat(oldVal, NewVal, WFStepName.EditGRN.ToString(), UserBLL.GetCurrentUser(), "Change GRN Status");
                        if (At == 1)
                        {
                            ECXWF.CMessage msg = WFTransaction.Request(TrackingNo);
                            if (msg == null)
                            {
                                throw new Exception("Unable to get WF Data.");
                            }
                            else if (msg.Name.Trim() == "EditGRN")
                            {
                                WFTransaction.WorkFlowManager(TrackingNo, msg);
                                isSaved = true;
                            }
                        }
                    }
                }
                else
                {
                    isSaved = false;
                }
                #region Depricatedcode
                //// Cancel Implemented by web service.
                //if (Status == GRNStatus.Cancelled)
                //{
                //    WarehouseRecieptBLL objWarehouseReciept = new WarehouseRecieptBLL();
                //    isSaved = GRNDAL.UpdateGRN(GRN_number, Status, trans);
                //    if (isSaved == true)
                //    {
                //        //isSaved = objWarehouseReciept.Cancel(this.Id);
                //        if (isSaved == true)
                //        {
                //            int At = -1;
                //            AuditTrailBLL objAt = new AuditTrailBLL();
                //            string oldVal = "(GRNNo-" + GRN_number + ") , (Status-" + PreviousStatus.ToString() + ")";
                //            string NewVal = "(GRNNo-" + GRN_number + ") , (Status-" + Status.ToString() + ")";
                //            At = objAt.saveAuditTrailStringFormat(oldVal, NewVal, WFStepName.EditGRN.ToString(), UserBLL.GetCurrentUser(), "Change GRN Status");
                //            if (At == 1)
                //            {
                //                isSaved = true;
                //            }
                //            else
                //            {
                //                isSaved = false;
                //            }
                //        }

                //    }
                //    else
                //    {
                //        throw new Exception("Unable to Cancel GRN.");
                //    }
                //    if (isSaved == true)
                //    {
                //        WFTransaction.WorkFlowManager(TrackingNo);
                //    }
                //}
                #endregion
                if (isSaved == true)
                {
                    trans.Commit();
                    trans.Dispose();
                    conn.Close();
                    return(true);
                }
                else
                {
                    trans.Rollback();
                    trans.Dispose();
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw ex;
            }
            finally
            {
                trans.Dispose();
                conn.Close();
            }
            return(false);
        }
Beispiel #5
0
        public bool ClientAcceptance(string GRN_number, DateTime AccptedTimeStamp, bool CAStatus, string TrackingNo, GRNStatus prevStatus)
        {
            bool           isSaved = false;
            SqlTransaction trans;
            SqlConnection  conn = new SqlConnection();

            conn  = Connection.getConnection();
            trans = conn.BeginTransaction();
            int status;

            if (CAStatus == true)
            {
                status = 4;
            }
            else
            {
                status = 5;
            }
            try
            {
                isSaved = GRNDAL.ClientAcceptance(GRN_number, AccptedTimeStamp, CAStatus, status, trans);
                if (isSaved == true)
                {
                    int           At     = -1;
                    AuditTrailBLL objAt  = new AuditTrailBLL();
                    string        oldVal = "(GRNNo-" + GRN_number + ") , (Status-" + prevStatus.ToString() + ")";
                    string        NewVal = "(GRNNo-" + GRN_number + ") , (Status-" + Status.ToString() + ")";
                    At = objAt.saveAuditTrailStringFormat(oldVal, NewVal, WFStepName.EditGRN.ToString(), UserBLL.GetCurrentUser(), "Change GRN Status");
                    if (At == 1)
                    {
                        WFTransaction.WorkFlowManager(TrackingNo);
                    }
                    else
                    {
                        isSaved = false;
                    }
                }
                if (isSaved == true)
                {
                    trans.Commit();
                    trans.Dispose();
                    conn.Close();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                trans.Rollback();
                trans.Dispose();
                conn.Close();
                throw ex;
            }

            return(false);
        }