Exemple #1
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);
        }
Exemple #2
0
 protected void btnNext_Click(object sender, EventArgs e)
 {
     if (ViewState["vsTranNo"] != null)
     {
         ECXWF.CMessage msg = WFTransaction.Request(ViewState["vsTranNo"].ToString().Trim());
         if (msg != null)
         {
             if (msg.Name == "AddVoucherInfo")
             {
                 WFTransaction.WorkFlowManager(ViewState["vsTranNo"].ToString().Trim(), msg);
             }
         }
     }
     Response.Redirect("ListInbox.aspx");
 }
Exemple #3
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string strTrackingNo = "";

            strTrackingNo        = this.txtTrackingNo.Text;
            this.lblstatus.Text  = "";
            this.lblMessage.Text = "";
            if (!(string.IsNullOrEmpty(strTrackingNo)))
            {
                try
                {
                    this.lblstatus.Text = WFTransaction.GetMessage(strTrackingNo);
                }
                catch
                {
                    this.lblMessage.Text = "Can't Find this tracking No.";
                }
            }
            else
            {
                this.lblMessage.Text = "please enter Tracking No.";
            }
        }
Exemple #4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     WFTransaction.WorkFlowManager(this.hfTrackingNo.Value.ToString());
 }
Exemple #5
0
        private string PageFactory(ECXWF.CMessage msg, string TranNo, object[] par)
        {
            if (Enum.GetNames(typeof(WorkflowTaskType)).Contains(msg.Name))
            {
                InitiateWorkflowTask(msg.Name);
            }
            if (msg.Name == "AddCommodityDepositeRequest")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddCommodityDepositRequest.aspx");
            }
            else if (msg.Name == "AddDriverInformation")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddDriverInformation.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "AddVoucherInfo")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddVoucherInformation.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "GetSampleTicket")
            {
                return("GetSampleTicket.aspx");
            }
            else if (msg.Name == "AddSamplingResult")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddSamplingResult.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "GenerateGradingCode")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("GenerateGradingCode.aspx");
            }
            else if (msg.Name == "AddGradingResult")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddGradingResult.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "GradingResultCA")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("GradingResultClientAcceptance.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "AddUnloadingInfo")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddUnloadingInformation.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "PreWeighTruck")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("PreWeighTruck.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "AddUnloadingInfo")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddUnloadingInformation.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "PostWeighTruck")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("PostWeighTruck.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "AddScalingInfo")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddScalingInformation.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "AddGRN")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("AddGRN.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "GRNAcceptance")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("GRNAcceptance.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "ClientAcceptance")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("GRNAcceptance.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "WarehouseManagerAppr")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("ViewGRN.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "WarehouseManagerApproval")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("ViewGRN.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "EditGRN")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("ViewGRN.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "EditGradeDispute")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("EditGradeDispute.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "ApproveReSampling")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("EditReSampling.aspx?TranNo=" + TranNo);
            }
            else if (msg.Name == "OpenGRNForEdit")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("OpenGRNEdit.aspx");
            }
            else if (msg.Name == "EditWHR")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("ReCreateGRN.aspx");
            }
            else if (msg.Name == "CancelGRN" || msg.Name.Trim() == "ApproveCancelationRequest")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("CancelGRN.aspx");
            }

            else if (msg.Name == "GetTrucksReadyForSam")
            {
                return("GetTrucksReadyForSampling.aspx");
            }
            else if (msg.Name == "ConfirmTrucksForSamp")
            {
                return("ConfirmTrucksForSampling.aspx");
            }
            else if (msg.Name == "Test")
            {
                return("Test1.aspx?Tran=" + TranNo);
            }
            else if (msg.Name.Trim() == "CodeSampRec")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("ReceiveSampleCode.aspx");
            }
            else if (msg.Name.Trim() == "EditGradingResult")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("EditGradingReceived.aspx?TrackingNo=" + TranNo.ToString());
            }
            else if (msg.Name.Trim() == "WHAppGRNEdit")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("EditApprovedGRNEditRequest.aspx");
            }
            else if (msg.Name.Trim() == "OpenGRNForEdit")
            {
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("OpenGRNEdit.aspx");
            }
            else if (msg.Name.Trim() == "UpdateGRNNo")
            {
                //GRN number edit
                WFTransaction.LoadVariables(msg.Name, TranNo);
                return("UpdateGRNNumber.aspx");
            }
            else if (msg.Name.Trim() == "UpdateClientNo")
            {
                //NoClient
                WFTransaction.LoadVariables(msg.Name, TranNo);
                string id = HttpContext.Current.Session["CommodityRequestId"].ToString();
                return("EditCommodityDepositRequest.aspx?id=" + id);
            }
            else
            {
                return("");
            }
        }
Exemple #6
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            #region co
            //string taskNo = txtTaskNo.Text.Trim();
            //if (taskNo != string.Empty)
            //{
            //    XMLHelper objHelper = new XMLHelper(Session["Inboxpath"].ToString());
            //    InboxItems item = objHelper.SearchByInboxItemName(Session["WarehouseInboxItemName"].ToString());
            //    List<TransactionDetail> listDisplay = item.GetTransactions().Where(t => t.TrackNo == taskNo).ToList();
            //    if ("Select Trucks For Sampling" == Session["WarehouseInboxItemName"].ToString())
            //    {
            //        TransactionDetail obj = new TransactionDetail("", "");
            //        obj.DisplayName = "Select Trucks for Sampling";
            //        obj.TrackNo = "GetTrucksReadyForSam";
            //        listDisplay.RemoveAll(RemovePredicate);
            //        listDisplay.Add(obj);
            //    }
            //    else if ("Confirm Trucks For Sampling" == Session["WarehouseInboxItemName"].ToString())
            //    {
            //        TransactionDetail obj = new TransactionDetail("", "");
            //        obj.DisplayName = "Confirm Truks For Sampling";
            //        obj.TrackNo = "ConfirmTrucksForSamp";
            //        listDisplay.RemoveAll(RemovePredicate);
            //        listDisplay.Add(obj);
            //    }
            //    else if ("Assign Sampler".Trim() == Session["WarehouseInboxItemName"].ToString().Trim())
            //    {
            //        TransactionDetail obj = new TransactionDetail("", "");
            //        obj.DisplayName = "Assign Sampler";
            //        obj.TrackNo = "GetSampleTicket";
            //        listDisplay.RemoveAll(RemovePredicate);
            //        listDisplay.Add(obj);
            //    }

            //    this.gvDetail.DataSource = listDisplay;
            //    this.gvDetail.DataBind();
            //}
            #endregion
            if (string.IsNullOrEmpty(txtTaskNo.Text))
            {
                msg.Text = "Please Provide Tracking No.";
                return;
            }
            string           strTR = txtTaskNo.Text.Trim();
            ECXWF.ECXEngine  eng   = new WarehouseApplication.ECXWF.ECXEngine();
            ECXWF.CMessage[] mess  = null;

            try
            {
                //eng.UnlockMessageByUser(Request.QueryString["TranNo"], "AddVoucherInformation", UserBLL.GetCurrentUser());
                //eng.RemoveTransactionFromStack(Request.QueryString["TranNo"]);
                mess = eng.Request(strTR, UserBLL.GetCurrentUser(), new string[] { WarehouseBLL.CurrentWarehouse.Location });
                if (mess != null)
                {
                    WFTransaction.UnlockTask(strTR);
                    List <TransactionDetail> lst = new List <TransactionDetail>(new TransactionDetail[] {
                        new TransactionDetail(strTR, strTR)
                    });


                    this.gvDetail.DataSource = lst;
                    this.gvDetail.DataBind();
                }
                else
                {
                    msg.Text = "No Tracking number matchs the supplied criteria";
                }
            }
            catch (Exception ex)
            {
                txtTaskNo.Text = "";
                msg.Text       = "Re-enter the Tracking No and Try Again";
                //throw ex;
            }
        }
Exemple #7
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");
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #8
0
        public static Nullable <Guid> GetRandomSamplingId(Guid WarehouseId)
        {
            Nullable <Guid> Id     = null;
            string          strSql = "spGetDepositeRequestWaitingSampling";
            SqlConnection   conn   = Connection.getConnection();

            SqlParameter[]     arPar = new SqlParameter[1];
            List <SamplingBLL> list  = null;
            SqlDataReader      reader;

            try
            {
                arPar[0]       = new SqlParameter("@WarehouseId", SqlDbType.UniqueIdentifier);
                arPar[0].Value = WarehouseId;
                String strId = "";

                reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql, arPar);
                if (reader.HasRows)
                {
                    list = new List <SamplingBLL>();
                    while (reader.Read())
                    {
                        SamplingBLL objSampling = new SamplingBLL();
                        if (reader["ReceivigRequestId"] != DBNull.Value)
                        {
                            objSampling.Id = new Guid(reader["ReceivigRequestId"].ToString());
                        }
                        if (reader["TrackingNo"] != DBNull.Value)
                        {
                            objSampling.TrackingNo = reader["TrackingNo"].ToString();
                        }
                        list.Add(objSampling);
                    }
                    if (list.Count < 1)
                    {
                        return(null);
                    }
                    else
                    {
                        foreach (SamplingBLL o in list)
                        {
                            try
                            {
                                string strm = WFTransaction.GetMessage(o.TrackingNo);
                                if (strm.ToUpper() == "GetSampleTicket".ToUpper())
                                {
                                    WFTransaction.UnlockTask(o.TrackingNo);
                                    return(o.Id);
                                }
                                else
                                {
                                    WFTransaction.UnlockTask(o.TrackingNo);
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (NullReferenceException ex)
            {
                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conn != null || conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(Id);
        }
Exemple #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="WarehouseId"></param>
        /// <returns>Commodity Deposite Request</returns>
        ///
        public static List <TrucksForSamplingBLL> GetRandomTrucksForSamplingId(Guid WarehouseId, int NumberOfTrucks)
        {
            List <TrucksForSamplingBLL> list = null;
            string        strSql             = "spGetTrucksWaitingSampling";
            SqlConnection conn = null;

            SqlParameter[] arPar  = new SqlParameter[2];
            SqlDataReader  reader = null;

            arPar[0]       = new SqlParameter("@WarehouseId", SqlDbType.UniqueIdentifier);
            arPar[0].Value = WarehouseId;
            arPar[1]       = new SqlParameter("@top", SqlDbType.Int);
            arPar[1].Value = NumberOfTrucks;

            try
            {
                conn   = Connection.getConnection();
                reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql, arPar);
                if (reader.HasRows)
                {
                    list = new List <TrucksForSamplingBLL>();
                    int counter = 1;
                    while (reader.Read())
                    {
                        TrucksForSamplingBLL obj = new TrucksForSamplingBLL();
                        obj.WarehouseId       = WarehouseId;
                        obj.ReceivigRequestId = new Guid(reader["Id"].ToString());
                        if (reader["DriverInformationId"] != DBNull.Value)
                        {
                            obj.DriverInformationId = new Guid(reader["DriverInformationId"].ToString());
                        }
                        else
                        {
                            obj.DriverInformationId = Guid.Empty;
                        }

                        obj.DateGenerated      = DateTime.Now;
                        obj.SamplerInspectorId = UserBLL.GetCurrentUser();
                        obj.Status             = TrucksForSamplingStatus.New;
                        obj.TrackingNo         = reader["TrackingNo"].ToString();
                        obj.CreatedBy          = UserBLL.GetCurrentUser();
                        obj.PlateNo            = reader["PlateNumber"].ToString();
                        obj.TrailerPlateNo     = reader["TrailerPlateNumber"].ToString();
                        if (obj.TrackingNo != "")
                        {
                            try
                            {
                                string strM = "";
                                strM = WFTransaction.GetMessage(obj.TrackingNo);
                                if (strM.ToUpper() == "GetTrucksReadyForSam".ToUpper())
                                {
                                    if (counter <= NumberOfTrucks)
                                    {
                                        list.Add(obj);
                                        counter++;
                                    }
                                }
                                WFTransaction.UnlockTask(obj.TrackingNo);
                            }
                            catch
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                reader.Close();
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
            return(list);
        }