예제 #1
0
        protected void btnAddWoreda_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            if (ViewState["ClassWoreda"] == null)
            {
                Messages.SetMessage("Please select one item from the Grid!", WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }

            List <woreda> classWoreda = (List <woreda>)ViewState["ClassWoreda"];

            if (!classWoreda.Exists(w => w.WoredaID == cboWoreda.SelectedValue))
            {
                woreda w = new woreda();
                w.WoredaID   = cboWoreda.SelectedValue;
                w.WoredaName = cboWoreda.SelectedItem.Text;
                classWoreda.Insert(0, w);
                ViewState["ClassWoreda"] = classWoreda;

                gvClassWereda.DataSource = classWoreda;
                gvClassWereda.DataBind();
            }
            else
            {
                Messages.SetMessage("Woreda entered already exists!", WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
            }
        }
예제 #2
0
        private void ReciveCode()
        {
            GradingModel objcode = new GradingModel();

            if (ViewState["GradingID"] != null)
            {
                GradingCodeID = new Guid(ViewState["GradingID"].ToString());
            }
            objcode.ID             = GradingCodeID;
            objcode.CodeReceivedBy = BLL.UserBLL.GetCurrentUser();
            try
            {
                objcode.CodeReceivedDateTime = DateTime.Parse(Convert.ToDateTime(txtDateRecived.Text).ToShortDateString() + " " + Convert.ToDateTime(txtTimeRecived.Text).ToShortTimeString());
            }
            catch (Exception ex)
            {
                Messages.SetMessage("Please enter Valid Date or Time", WarehouseApplication.Messages.MessageType.Error);
                return;
            }
            objcode.WarehouseId = BLL.UserBLL.GetCurrentWarehouse();
            objcode.UserId      = BLL.UserBLL.GetCurrentUser();
            objcode.UpdateRecivedCode();
            btnNext.Visible = true;
            Messages.SetMessage("Data update Successfull.", WarehouseApplication.Messages.MessageType.Success);
        }
예제 #3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         string   driverFullName = txtDriverName.Text.ToString().Trim();
         string[] tokenNames     = driverFullName.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
         if (int.Parse(tokenNames.Length.ToString()) > 3 || int.Parse(tokenNames.Length.ToString()) < 3)
         {
             throw new Exception("Invalid Driver Name!");
         }
     }
     catch (Exception ex)
     {
         Messages.SetMessage(ex.Message, WarehouseApplication.Messages.MessageType.Error);
         return;
     }
     try
     {
         PageToObject();
         if (theArrival.IsValid())
         {
             theArrival.Save();
         }
         Messages.SetMessage("Arrival record saved successfully.", WarehouseApplication.Messages.MessageType.Success);
         btnNext.Enabled   = true;
         btnNext.BackColor = System.Drawing.ColorTranslator.FromHtml("#88AB2D");
     }
     catch (Exception ex)
     {
         Messages.SetMessage("Arrival record not saved.  Please try again.", WarehouseApplication.Messages.MessageType.Error);
     }
 }
예제 #4
0
        private bool doValidMain()
        {
            Messages.ClearMessage();
            if (txtDateOfAcceptance.Text.Trim() == string.Empty)
            {
                Messages.SetMessage("Please enter date of acceptance.", WarehouseApplication.Messages.MessageType.Warning);
                return(false);
            }
            if (lblGradingReceivedDateValue.Text.Trim() == string.Empty)
            {
                Messages.SetMessage(" Please enter grading received date.", WarehouseApplication.Messages.MessageType.Warning);
                return(false);
            }
            if (Convert.ToDateTime(txtDateOfAcceptance.Text + " " + txtTimeodAcceptance.Text) <= Convert.ToDateTime(lblGradingReceivedDateValue.Text))
            {
                Messages.SetMessage("Date of acceptance must be later than Grading received date.", WarehouseApplication.Messages.MessageType.Warning);
                return(false);
            }

            if (cboAcceptanceStatus.SelectedIndex == 0)
            {
                Messages.SetMessage("Status is required.", WarehouseApplication.Messages.MessageType.Warning);
                return(false);
            }
            return(true);
        }
예제 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Elias Getachew
                //To integrate with Inbox
                this.GradingCode = string.Empty;
                this.GradingCode = Request.QueryString["GradingCode"].ToString();
                if (string.IsNullOrEmpty(this.GradingCode))
                {
                    //display error message
                    Messages.SetMessage("Please Log out and try again.", WarehouseApplication.Messages.MessageType.Error);
                    return;
                }
                //Get data from
                GradingModel o = GradingModel.GetGradingInformationByGradingCode(GradingCode);
                if (o == null)
                {
                    Messages.SetMessage("Unable to find data with the selected Code.", WarehouseApplication.Messages.MessageType.Error);
                    return;
                }



                lblDateCodedValue.Text   = DateTime.Now.ToShortDateString(); //o.DateTimeCoded.ToShortDateString();
                lblGradingCodeValue.Text = o.GradingCode;
                ViewState["GradingID"]   = o.ID;
                this.GradingCodeID       = o.ID;
                this.Page.DataBind();
            }
        }
예제 #6
0
        protected void btnGenerateCode_Click(object sender, EventArgs e)
        {
            GradingModel gm           = (GradingModel)Session["gModel"];
            string       errorMessage = string.Empty;

            try
            {
                //gm.AddGrader(sm.UserId, sm.isSupervisor);
                if (gm == null)
                {
                    Messages.SetMessage("Empty Data.", WarehouseApplication.Messages.MessageType.Error);
                }
                else
                {
                    if (GenerateCode(gm))
                    {
                        Session["GraderID"] = gm.ID;
                        PrintCode();
                        Messages.SetMessage("Code Generated Successfully.", WarehouseApplication.Messages.MessageType.Success);
                        btnGenerateCode.Visible = false;
                        btnNext.Visible         = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
            }
        }
예제 #7
0
        protected void btnAddStack_Click(object sender, EventArgs e)
        {
            StackTransactionModel sm = GetStack();

            //if (sm.IsValid())
            //{
            if (!RemainingWeight())
            {
                Messages.SetMessage("Requested Net Weight is greater than total available PUN weight. Please check the Loading Ticket.", WarehouseApplication.Messages.MessageType.Warning);
            }
            else
            {
                GINModel ginModel = new GINModel();
                ginModel = (GINModel)Session["GINMODEL"];
                try
                {
                    DateTime dtm  = DateTime.Parse((Convert.ToDateTime(txtDateWeighted.Text).ToShortDateString()) + " " + Convert.ToDateTime(txtDateWeightedTime.Text).ToShortTimeString());
                    DateTime dtm2 = DateTime.Parse((Convert.ToDateTime(txtDateLoaded.Text).ToShortDateString()) + " " + Convert.ToDateTime(txtDateLoadedTime.Text).ToShortTimeString());
                    ginModel.AddStack(new Guid(drpStackNo.SelectedValue), new Guid(drpWeigherSupervisor.SelectedValue), txtScaleTicketNo.Text, txtLoadingTicket.Text, dtm, Convert.ToDouble(txtTruckWeight.Text), Convert.ToDouble(txtGrossWeight.Text), Convert.ToDouble(txtNoOfBags.Text), dtm2, Convert.ToInt32(drpTruckType.SelectedValue), Convert.ToInt32(drpWBServiceProvider.SelectedValue));
                    btnAddStack.Visible = false;
                }
                catch (Exception ex)
                {
                    Messages.SetMessage(ex.Message, WarehouseApplication.Messages.MessageType.Warning);
                }
                gvStack.DataSource = ginModel.StackInfosList;
                gvStack.DataBind();
                Session["GINMODEL"] = ginModel;
                DoNewStack();
            }
            //}
        }
예제 #8
0
        public bool DoValid(ModelWRNO objImport)
        {
            DataTable dt = new DataTable();

            dt = objImport.CheckWRNo(Convert.ToInt32(txtWareHouseReceiptNo.Text));
            if (txtWareHouseReceiptNo.Text.Trim() == string.Empty)
            {
                Messages.SetMessage("WareHouse Receipt No Required.", WarehouseApplication.Messages.MessageType.Error);
                return(false);
            }
            else if (dt.Rows.Count > 0)
            {
                Messages.SetMessage("Already Exist.", WarehouseApplication.Messages.MessageType.Error);
                return(false);
            }
            else if (txtDate.Text.Trim() == string.Empty)
            {
                Messages.SetMessage("Dsate Required.", WarehouseApplication.Messages.MessageType.Error);
                return(false);
            }
            else if (txtRemark.Text.Trim() == string.Empty)
            {
                Messages.SetMessage("Remark Required.", WarehouseApplication.Messages.MessageType.Error);
                return(false);
            }
            return(true);
        }
예제 #9
0
        void SaveWoreda(bool isNEW)
        {
            if (cboRegion.SelectedIndex <= 0)
            {
                Messages.SetMessage("Please select Region first!", WarehouseApplication.Messages.MessageType.Warning);
                UpdatePanel1.Update();
                return;
            }
            else if (gvZone.SelectedIndex < 0)
            {
                Messages.SetMessage("Please select Zone first!", WarehouseApplication.Messages.MessageType.Warning);
                UpdatePanel1.Update();
                return;
            }
            ModelLocation ml = new ModelLocation();

            ml.ID          = isNEW ? Guid.NewGuid() : new Guid(((Label)gvWereda.SelectedRow.FindControl("lblWoredaID")).Text.Trim());
            ml.Description = txtAddWoreda.Text.Trim();
            ml.RegionID    = new Guid(cboRegion.SelectedValue);
            ml.ZoneID      = new Guid(drpWoredaZone.SelectedValue);
            ml.WoredaID    = ml.ID;
            ml.Save();
            FillWorada();
            Messages.SetMessage("Location successfully updated!", WarehouseApplication.Messages.MessageType.Success);
            UpdatePanel1.Update();
        }
예제 #10
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            GradingModel gModel;

            if (Session["gModel"] == null)
            {
                gModel = new GradingModel();
                Session.Add("gModel", gModel);
            }
            else
            {
                gModel = (GradingModel)Session["gModel"];
            }
            try
            {
                gModel.AddGrader(new Guid(drpGrader.SelectedValue), chkIsSupervisor.Checked);
            }
            catch (Exception ex)
            {
                Messages.SetMessage(ex.Message.ToString(), WarehouseApplication.Messages.MessageType.Error);
            }

            gvGradingBy.DataSource = gModel.gradinginfoList;
            gvGradingBy.DataBind();
        }
예제 #11
0
        private void SaveBondedYardGIN()
        {
            GINModel ginmodel = CurrentGINModel;

            ginmodel.SaveBondedYard();
            Messages.SetMessage("GIN with GIN Number " + ginmodel.GINNumber + " is successfully saved " + Session["RemainingMsg"], WarehouseApplication.Messages.MessageType.Success);
            btnSave.Visible = false;
        }
예제 #12
0
        private void BindData()
        {
            int    warehouseReceipt;
            string clientId = txtClientId.Text;

            Guid?licID = null;

            if (drpLIC.SelectedIndex > 0)
            {
                licID = new Guid(drpLIC.SelectedItem.Value);
            }
            string PSANo       = txtPSANo.Text;
            Guid   warehouseId = UserBLL.GetCurrentWarehouse();

            if (txtWareHouseReceipt.Text.Equals(string.Empty))
            {
                warehouseReceipt = 0;
            }
            else
            {
                warehouseReceipt = Convert.ToInt32(txtWareHouseReceipt.Text);
            }
            //if (clientId.Trim().Length <= 0 && licID == null && warehouseReceipt == 0 && PSANo.Trim().Length <= 0)
            //{
            //    Messages.SetMessage("Please select/enter on one of the search criteria", WarehouseApplication.Messages.MessageType.Warning);
            //    return;
            //}

            List <GINModel> gmList = new List <GINModel>();

            gmList = GINModel.getUnApprovedPSA(clientId, warehouseReceipt, licID, PSANo, warehouseId);
            gvApproval.DataSource = gmList;
            gvApproval.DataBind();
            if ((txtPSANo.Text.Trim().Length > 0 || txtWareHouseReceipt.Text.Trim().Length > 0) && gmList != null && gmList.Count > 0)
            {
                try
                {
                    drpLIC.SelectedValue = gmList[0].LeadInventoryControllerID.ToString();
                }
                catch
                {
                    drpLIC.SelectedIndex = 0;
                    for (int i = 1; drpLIC.Items.Count > i; i++)
                    {
                        if (drpLIC.Items[i].Text == gmList[0].LeadInventoryController)
                        {
                            drpLIC.SelectedIndex = i;
                            break;
                        }
                    }
                    if (drpLIC.SelectedIndex == 0)
                    {
                        Messages.SetMessage("LIC " + gmList[0].LeadInventoryController + " not found in the list", WarehouseApplication.Messages.MessageType.Warning);
                    }
                }
            }
        }
예제 #13
0
        /// <summary>
        /// Populate information inserted at previous stages like cdr and Grading stages
        /// and display it as a table inside gridview. It uses on stored procedure to populate data
        /// </summary>
        private void LoadDisplayInfo(string GradingCode)
        {
            try
            {
                GRN_BL obj = new BLL.GRN_BL();

                DataTable dt = obj.GetDisplayInfoByGradingCode(GradingCode);
                grdDisplayInfo.DataSource = dt;
                grdDisplayInfo.DataBind();
                //If coffee then change lable to Kg. Else change label to Qtl.
                if (dt.Rows[0]["CommodityId"].ToString() == "71604275-df23-4449-9dae-36501b14cc3b")
                {
                    lblUnit1.Text = "Kg.";
                    lblUnit2.Text = "Kg.";
                }
                else
                {
                    lblUnit1.Text = "Qtl.";
                    lblUnit2.Text = "Qtl.";
                }
                GRNStatusNew status;
                GRNStatusNew.TryParse((dt.Rows[0]["status"].ToString()), out status);

                if (status == GRNStatusNew.New || status == GRNStatusNew.NotCreated)
                {
                    btnSave.Enabled = true;
                }
                else
                {
                    btnSave.Enabled = false;
                    btnSave.ToolTip = "Can't Update GRN because it is at " + status.ToString() + " Stage";
                }
                ViewState["WarehouseId"]    = dt.Rows[0]["WarehouseId"].ToString();
                ViewState["ProductionYear"] = dt.Rows[0]["Pro_Year"].ToString();

                Session["ArrivalId_GRN"]        = new Guid(dt.Rows[0]["ArrivalId"].ToString());
                Session["GradeId_GRN"]          = new Guid(dt.Rows[0]["GradeId"].ToString());
                Session["CommodityGradeId_GRN"] = new Guid(dt.Rows[0]["CommodityGradeId"].ToString());
                Session["ShedId_GRN"]           = new Guid(dt.Rows[0]["ShedId"].ToString());
                Session["LICID_GRN"]            = new Guid(dt.Rows[0]["LICID"].ToString());

                hdnTare.Value = dt.Rows[0]["Tare"].ToString();
                ViewState["CommodityGradeId"] = dt.Rows[0]["CommodityGradeId"].ToString();
                ViewState["TrackingNumber"]   = dt.Rows[0]["TrackingNumber"].ToString();
                ViewState["GRNID"]            = dt.Rows[0]["GRNID"].ToString();

                BagTypeId = new Guid(dt.Rows[0]["BagTypeId"].ToString());
                txtClientAcceptanceDate.Text  = DateTime.Parse(dt.Rows[0]["ClientAcceptanceDate"].ToString()).ToString("g");
                hdnClientAcceptanceDate.Value = DateTime.Parse(dt.Rows[0]["ClientAcceptanceDate"].ToString()).ToShortDateString();
                string TrackingNumber = ViewState["TrackingNumber"].ToString();
                PopulateSameGradingGrid(TrackingNumber);
            }
            catch
            {
                Messages.SetMessage("Failed to load existing information!");
            }
        }
예제 #14
0
        private void SaveGINPSA()
        {
            GINModel ginPSAModel = CurrentGINModel;

            ginPSAModel.IsPSA = true;
            ginPSAModel.SavePSA();

            Messages.SetMessage("PSA with PSA Number " + ginPSAModel.GINNumber + " is saved successfully ", WarehouseApplication.Messages.MessageType.Success);
        }
예제 #15
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            string ginApprovalInfoXML = "<PSAApproval>";
            string errorMsg = ""; DateTime dtValue = new DateTime();

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    DropDownList cStatus = (DropDownList)gvApproval.Rows[gvr.RowIndex].FindControl("drpClientStatus");
                    if (cStatus.SelectedIndex <= 0)
                    {
                        errorMsg += "the client signed status must me selected! ";
                    }
                    DropDownList licStatus = (DropDownList)gvApproval.Rows[gvr.RowIndex].FindControl("drpLICStatus");
                    if (licStatus.SelectedIndex <= 0)
                    {
                        errorMsg += "the LIC signed status must me selected! ";
                    }
                    TextBox cdate = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeClientSigned");
                    TextBox ctime = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeClientSigned");
                    if (!DateTime.TryParse(cdate.Text + " " + ctime.Text, out dtValue) || dtValue > DateTime.Now)
                    {
                        errorMsg += "please select current Client signed date and time! ";
                    }
                    TextBox licdate = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned");
                    TextBox lictime = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned");
                    if (!DateTime.TryParse(licdate.Text + " " + lictime.Text, out dtValue) || dtValue > DateTime.Now)
                    {
                        errorMsg += "please select current LIC signed date and time! ";
                    }
                    if (errorMsg != string.Empty)
                    {
                        errorMsg = "For the PSA with number '" + ((Label)gvr.FindControl("lblPSA")).Text + "' " + errorMsg;
                        Messages.SetMessage(errorMsg, WarehouseApplication.Messages.MessageType.Error);
                        return;
                    }
                    ginApprovalInfoXML +=
                        "<PSAApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Value.ToString() + "</ID>" +
                        "<ClientSignedDate>" + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeClientSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeClientSigned")).Text + "</ClientSignedDate>" +
                        "<ClientSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ClientSignedName>" +
                        "<LICSignedDate>" + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned")).Text + "</LICSignedDate>" +
                        "<LICSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</LICSignedName>" +
                        "<PSAStatusID>" + CalculatePSAStatus(gvr) + "</PSAStatusID>" +
                        "<PSAStatusID>" + CalculatePSAStatus(gvr) + "</PSAStatusID>" +
                        "<UserId>" + BLL.UserBLL.CurrentUser.UserId + "</UserId>" +
                        "</PSAApprovalItem>";
                }
            }
            ginApprovalInfoXML += "</PSAApproval>";
            GINModel.ApprovePSA(ginApprovalInfoXML);
            Messages.SetMessage("SUCCESS: The PSA Approved and it is out of unapproved list!", Messages.MessageType.Success);
            btnApprove.Style["visibility"] = "hidden";
            BindData();
        }
예제 #16
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool isCoffee            = false;
            StackTransactionModel sm = GetStack();
            GINModel gm = CurrentGINModel;

            if (CurrentGINModel.PickupNoticesList[0].Commodity == new Guid("71604275-df23-4449-9dae-36501b14cc3b"))
            {
                isCoffee = true;
            }
            string errorMessage = string.Empty;

            try
            {
                if (RemainingWeight())
                {
                    if (SateGIN())
                    {
                        if (sm.IsValid(isCoffee))
                        {
                            if (isCoffee)
                            {
                                SaveBondedYardGIN();
                            }
                            else
                            {
                                gm.AddStack(sm);
                                if (gm.IsValid())
                                {
                                    SaveGIN();
                                }
                                else
                                {
                                    errorMessage = gm.ErrorMessage;
                                    Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
                                }
                            }
                        }
                        else
                        {
                            errorMessage = gm.ErrorMessage;
                            Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
                        }
                    }
                    else
                    {
                        Session["remainingBalance"] = null;
                    }
                }
            }
            catch (Exception ex)
            {
                Session["remainingBalance"] = Convert.ToDouble(Session["remainingBalance"]) + Convert.ToDouble(Session["netWeight"]);
                Messages.SetMessage(ex.Message.ToString(), WarehouseApplication.Messages.MessageType.Error);
            }
        }
예제 #17
0
 protected void btnOk_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow gvr in this.gvApproval.Rows)
     {
         GINModel objApp = new GINModel();
         objApp.ID = new Guid(Session["GinId"].ToString());
         Messages.SetMessage("SUCCESS: The Gin Approved and it is out of unapproved list!", Messages.MessageType.Success);
     }
     BindData();
 }
예제 #18
0
        protected void btnPrintPUN_Click(object sender, EventArgs e)
        {
            List <PickupNoticeModel> names = new List <PickupNoticeModel>();
            string punIds     = string.Empty;
            int    WeightInKg = 0;

            foreach (GridViewRow gvr in this.gvSearchPickupNotice.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    PickupNoticeModel g = new PickupNoticeModel();
                    if (!string.IsNullOrEmpty(punIds))
                    {
                        punIds += ",";
                    }
                    punIds += gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString();
                    g.ID    = new Guid(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString());
                    names.Add(g);
                    WeightInKg = WeightInKg + Convert.ToInt32(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["WeightInKg"]);
                }
            }


            List <PickupNoticeModel> pikListcheck = PickupNoticeModel.PrintPUNChecking(punIds);

            if (pikListcheck.Count > 0)
            {
                Session["ReportType"] = "DoNuthing";
                Messages.SetMessage("You may contact system administrator for assistance. From selected PUN list the following WHR# are already printed: " + pikListcheck.Select(s => s.WarehouseReceiptNo.ToString()).Aggregate((str, nex) => str + "," + nex), Messages.MessageType.Warning);
            }
            else
            {
                List <PickupNoticeModel> pikList = PickupNoticeModel.PreparePUNId(punIds);
                if (pikList.Count > 0)
                {
                    Session["ReportType"] = "PUN";
                    Session["PUNID"]      = pikList.Select(s => s.ID.ToString()).Aggregate((str, nex) => str + "," + nex);
                    ScriptManager.RegisterStartupScript(this,
                                                        this.GetType(),
                                                        "ShowReport",
                                                        "<script type=\"text/javascript\">" +
                                                        string.Format("javascript:window.open(\"ReportViewer.aspx\", \"_blank\",\"height=1000px,width=1000px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +

                                                        "</script>",
                                                        false);
                }
                else
                {
                    Messages.SetMessage("The system can’t print this Pun please contact Administrator ", Messages.MessageType.Warning);
                }
            }
            btnGINProcess.Style["visibility"] = "Visible";
            btnPrintPUN.Style["visibility"]   = "Visible";
            btnProcessPSA.Style["visibility"] = "Visible";
        }
예제 #19
0
 protected void btnDisable_Click(object sender, EventArgs e)
 {
     if (DoValid())
     {
         DisableOperator();
         FillWareHouse();
         FillType();
         FillOperator();
         //drpShed.SelectedIndex = 0;
         Messages.SetMessage("Successfully updated", WarehouseApplication.Messages.MessageType.Success);
     }
 }
예제 #20
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            string   ginApprovalInfoXML = "<GINApproval>";
            DateTime LICSignedDate, ManagerSignedDate;
            string   GINNO;

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    if (((Label)gvr.FindControl("lblstatusLIC")).Text == "Reject")
                    {
                        Session["btnApprove"] = false;
                    }

                    LICSignedDate     = Convert.ToDateTime(((Label)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("lblDateTimeLICSigned")).Text);
                    ManagerSignedDate = Convert.ToDateTime(((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtDateTimeManagerSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtTimeManagerSigned")).Text);
                    GINNO             = ((Label)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("lblGINNo")).Text;
                    if (ManagerSignedDate > DateTime.Now)
                    {
                        Messages.SetMessage(" Manager Signed Date MUST NOT BE greater than todday!! on GIN Number" + GINNO, Messages.MessageType.Error);
                        return;
                    }
                    if (ManagerSignedDate >= LICSignedDate)
                    {
                        ginApprovalInfoXML +=
                            "<GINApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Values["Id"].ToString() + "</ID>" +
                            "<ManagerSignedDate>" + ManagerSignedDate + "</ManagerSignedDate>" +
                            "<ManagerSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ManagerSignedName>" +
                            "<GINStatusID>" + CalculateGINStatus(gvr) + "</GINStatusID>" +
                            "</GINApprovalItem>";
                    }
                    else
                    {
                        Messages.SetMessage("  Manager Signed Date have to greater or equal to  LIC Signed Date.", Messages.MessageType.Warning);
                        return;
                    }
                }
            }
            if (!Convert.ToBoolean(Session["btnApprove"]))
            {
                Messages.SetMessage("You Can NOT Approve Rejected GIN!", Messages.MessageType.Error);
                Session["btnApprove"] = true;
                return;
            }
            ginApprovalInfoXML += "</GINApproval>";
            GINModel.ApproveManager(ginApprovalInfoXML);
            BindData();
            Messages.SetMessage("The Gin Approved and it is out of unapproved list!", Messages.MessageType.Success);
        }
예제 #21
0
        private bool RemainingWeight()
        {
            GINModel ginModel = (GINModel)Session["GINMODEL"];
            double   remainingBalance;

            if (Session["remainingBalance"] == null)
            {
                if (Session["EditMode"] == null)
                {
                    Session["remainingBalance"] = ginModel.PickupNoticesList.Sum(s => s.RemainingWeight);
                }
                else
                {
                    Session["remainingBalance"] = ginModel.PickupNoticesList.Sum(s => s.RemainingWeight);
                }
            }
            Guid commodityGradeId         = ((GINModel)Session["GINMODEL"]).PickupNoticesList[0].CommodityGradeID;
            List <BagTypeBLL> bagTypeList = BagTypeBLL.GetCommodityGradeBagTypes(commodityGradeId);

            double netWeight = 0;

            if (CurrentGINModel.PickupNoticesList[0].ConsignmentType != "Bonded Yard")
            {
                netWeight = double.Parse(txtGrossWeight.Text) - double.Parse(txtTruckWeight.Text) -
                            double.Parse(txtNoOfBags.Text) * double.Parse(HiddenFieldTare.Value) +
                            double.Parse(drpAdjustmentType.SelectedValue) * double.Parse(txtWeightAdjustment.Text);
            }
            else if (CurrentGINModel.PickupNoticesList[0].ConsignmentType == "Bonded Yard")
            {
                HiddenFieldTare.Value = "0.93";
                netWeight             = double.Parse(txtNetWeight.Text);
            }
            Session["netWeight"] = netWeight;
            remainingBalance     = Math.Round(double.Parse(Session["remainingBalance"].ToString()), 2) - Math.Round(netWeight, 2);
            if (CurrentGINModel.PickupNoticesList[0].Commodity != new Guid("71604275-df23-4449-9dae-36501b14cc3b"))
            {
                if (remainingBalance < 0)
                {
                    Messages.SetMessage("Requested Net Weight is greater than total available PUN weight. Please check the Loading Ticket.", WarehouseApplication.Messages.MessageType.Warning);
                    return(false);
                }
            }
            if (remainingBalance >= 0)
            {
                Session["RemainingMsg"] = "Selected PUNs have Total Remaining weights to be issued of = " + Convert.ToDouble(remainingBalance) + " Kg";
            }
            Session["remainingBalance"] = remainingBalance;

            return(true);
        }
예제 #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //FillGINStatus();
         FillLIC(drpLIC, WareHouseOperatorTypeEnum.LIC);//Inventory Coordinator
         btnApprove.Style["visibility"] = "hidden";
         btnCancel.Style["visibility"]  = "hidden";
         bool approved = false;
         if (Request.Params["approved"] != null && bool.TryParse(Request.Params["approved"], out approved))
         {
             Messages.SetMessage("SUCCESS: The PSA Approved and it is out of unapproved list!", Messages.MessageType.Success);
         }
     }
 }
예제 #23
0
        void SaveRegion(bool isNEW)
        {
            ModelLocation ml = new ModelLocation();

            ml.ID          = isNEW ? Guid.NewGuid() : new Guid(cboRegion.SelectedValue);
            ml.Description = txtAddRegion.Text.Trim();
            ml.RegionID    = ml.ID;
            ml.ZoneID      = null;
            ml.WoredaID    = null;
            ml.Save();
            Messages.SetMessage("Location successfully updated!", WarehouseApplication.Messages.MessageType.Success);
            UpdatePanel1.Update();
            FillRegion(cboRegion);
            txtAddRegion.Text = string.Empty;
        }
예제 #24
0
        private void SaveSampling(GridView gv)
        {
            //  this.lblMessage.Visible = false;

            Messages.ClearMessage();

            SamplingModel sampleModel = SetSampling(gv);

            UpdatePanel4.Update();
            if (sampleModel == null)
            {
                return;
            }

            try
            {
                sampleModel.Save();
            }
            catch (Exception ex)
            {
                if (ex.Message.ToUpper().Contains("Sample Code".ToUpper()))
                {
                    string msg = ex.Message.Split('|').First(s => s.ToUpper().Contains("Sample Code".ToUpper()));
                    Messages.SetMessage(msg, Messages.MessageType.Error);
                    return;
                }
                else
                {
                    throw;
                }
            }

            //Repopulate the grid
            int searchCase = gv.ID == "gvWaitingForSampling" ? 1 : gv.ID == "gvWaitForDriver" ? 2 : 3;

            populateGrid(searchCase, true);

            Session["ReportType"] = "SampleTicket";
            Session["SampleId"]   = sampleModel.ID;
            ScriptManager.RegisterStartupScript(this,
                                                this.GetType(),
                                                "ShowReport",
                                                "<script type=\"text/javascript\">" +
                                                string.Format("javascript:window.open(\"ReportViewer.aspx\", \"_blank\",\"height=1000px,width=1000px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +

                                                "</script>",
                                                false);
        }
예제 #25
0
        protected void btnRemoveRegion_Click(object sender, EventArgs e)
        {
            DataTable dt = ModelLocation.GetZone(new Guid(cboRegion.SelectedValue));

            if (dt.Rows.Count > 0)
            {
                Messages.SetMessage("The Region contains " + dt.Rows.Count +
                                    " zone under it. Removing Region having one or more zone is not allowed!"
                                    , WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }

            ModelLocation.DeleteLocation(new Guid(cboRegion.SelectedValue));
            FillRegion(cboRegion);
        }
예제 #26
0
        protected void gvStack_SelectedIndexChanged(object sender, EventArgs e)
        {
            GINModel gm            = (GINModel)Session["GINMODEL"];
            Guid     stackLoadedId = new Guid(gvStack.SelectedDataKey["StackID"].ToString());

            if (gm.StackInfosList.Count != 0)
            {
                StackTransactionModel stm     = gm.StackInfosList.First(s => s.StackID == stackLoadedId);
                Guid commodityGradeId         = ((GINModel)Session["GINMODEL"]).PickupNoticesList[0].CommodityGradeID;
                List <BagTypeBLL> bagTypeList = BagTypeBLL.GetCommodityGradeBagTypes(commodityGradeId);

                if (Session["remainingBalance"] == null)
                {
                    Session["remainingBalance"] = gm.PickupNoticesList.Sum(s => s.RemainingWeight);//+ (stm.GrossWeight - stm.TruckWeight - bagTypeList[0].Tare * stm.NoOfBags);
                }
                else
                {
                    Session["remainingBalance"] = (double)Session["remainingBalance"] + (stm.GrossWeight - stm.TruckWeight - stm.Tare * stm.NoOfBags);
                }
                txtScaleTicketNo.Text    = stm.ScaleTicketNumber;
                txtDateWeighted.Text     = stm.DateTimeWeighed.ToShortDateString();
                txtDateWeightedTime.Text = stm.DateTimeWeighed.ToShortTimeString();
                txtTruckWeight.Text      = stm.TruckWeight.ToString();
                txtGrossWeight.Text      = stm.GrossWeight.ToString();
                txtNoOfBags.Text         = stm.NoOfBags.ToString();
                txtLoadingTicket.Text    = stm.LoadUnloadTicketNO;
                PopulateStack(new Guid(drpInventoryCoordinatorLoad.SelectedValue));
                drpStackNo.SelectedValue = stm.StackID.ToString();
                //stm.StackID = new Guid(drpStackNo.SelectedValue);
                HiddenFieldTare.Value = stm.Tare.ToString();
                drpWeigherSupervisor.SelectedValue = stm.WeigherID.ToString();// drpWeigherSupervisor.Items.Cast<ListItem>().First(s => new Guid(s.Value) == stm.WeigherID).Value;
                gm.StackInfosList.Remove(stm);
                gm.RemoveStack(stm.StackID);
                btnAddStack.Visible = true;
                FillWBServiceProvider(drpWBServiceProvider);
                drpWBServiceProvider.SelectedValue = stm.WBServiceProviderID.ToString();
                //drp
                FillCarType(drpTruckType);
                drpTruckType.SelectedValue = stm.TruckTypeID.ToString();
                // gvStack.DataSource = gm.StackInfosList;
                // gvStack.DataBind();
            }
            else
            {
                Messages.SetMessage("The stack is already selected or Empty Stack.", WarehouseApplication.Messages.MessageType.Warning);
            }
        }
예제 #27
0
        protected void gvZone_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            DataTable dt = ModelLocation.GetWoreda(new Guid(((Label)gvZone.Rows[e.RowIndex].FindControl("lblZoneID")).Text.Trim())
                                                   , new Guid(cboRegion.SelectedValue));

            if (dt.Rows.Count > 0)
            {
                Messages.SetMessage("The zone contains " + dt.Rows.Count +
                                    " worada under it. Removing a zone having one or more worada is not allowed!"
                                    , WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }

            ModelLocation.DeleteLocation(new Guid(((Label)gvZone.Rows[e.RowIndex].FindControl("lblZoneID")).Text));
            FillZone();
        }
예제 #28
0
        void Save()
        {
            Messages.ClearMessage();
            if (gvCommodityClassGrade.SelectedIndex < 0 && gvCommodityGrade.SelectedIndex < 0)
            {
                Messages.SetMessage("Please select one item from the Grid!", WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }

            ModelCommoditySymbol mcs = new ModelCommoditySymbol();

            SetValues(mcs);
            mcs.Save();
            lbtnReload_Click(null, null);
            Messages.SetMessage("Record saved successfully!", WarehouseApplication.Messages.MessageType.Success);
        }
예제 #29
0
        private bool GenerateCode(GradingModel objcode)
        {
            if (ViewState["sampleCode"] == null)
            {
                Messages.SetMessage("An error has occurred Please log out and Try Agian.", WarehouseApplication.Messages.MessageType.Error);
                return(false);
            }
            SamplingCode = ViewState["sampleCode"].ToString();
            List <GradingModel> samplingList = GradingModel.getSamplingInfo(SamplingCode);

            if (samplingList[0].CodeGenerated != true)
            {
                WarehouseApplication.BLL.GradingBLL objrandom = new WarehouseApplication.BLL.GradingBLL();
                objcode.ID = Guid.NewGuid();
                Session["GenerateCode"]  = objcode.ID;
                objcode.SamplingsID      = samplingList[0].SamplingsID;
                objcode.ArrivalID        = samplingList[0].ArrivalID;
                objcode.TrackingNumber   = samplingList[0].TrackingNumber;
                objcode.GradingCode      = objcode.GetRandomCode(UserBLL.GetCurrentWarehouseCode());
                objcode.DateTimeCoded    = DateTime.Now;
                objcode.WarehouseId      = UserBLL.GetCurrentWarehouse();
                objcode.CreatedBy        = UserBLL.GetCurrentUser();
                objcode.CreatedTimestamp = DateTime.Now;
                GraderModel value = objcode.gradinginfoList.Find(s => (s.isSupervisor == true));
                if (value == null)
                {
                    Messages.SetMessage("At least one supervisor required.", WarehouseApplication.Messages.MessageType.Error);
                    return(false);
                }
                try
                {
                    objcode.Save();
                    return(true);
                }
                catch
                {
                    Messages.SetMessage("Unable to save record. Please try again.", WarehouseApplication.Messages.MessageType.Error);
                    return(false);
                }
            }
            else
            {
                Messages.SetMessage("Code Already Generated.", WarehouseApplication.Messages.MessageType.Error);
                return(false);
            }
        }
예제 #30
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            string   ginApprovalInfoXML = "<GINApproval>";
            DateTime ClientSignedDate, LICSignedDate, DateIssued;
            string   GINNO;

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    ClientSignedDate = Convert.ToDateTime(((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtDateTimeClientSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtTimeClientSigned")).Text);
                    LICSignedDate    = Convert.ToDateTime(((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtDateTimeLICSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtTimeLICSigned")).Text);

                    DateIssued = Convert.ToDateTime((gvApproval.Rows[gvr.RowIndex].Cells[7].Text));
                    GINNO      = ((Label)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("lblGINNo")).Text;

                    if ((ClientSignedDate > DateTime.Now) || (LICSignedDate > DateTime.Now))
                    {
                        Messages.SetMessage(" Client Signed Date and LIC Signed Date MUST NOT BE greater than todday!! on GIN Number" + GINNO, Messages.MessageType.Error);
                        return;
                    }
                    if (ClientSignedDate >= DateIssued && LICSignedDate >= ClientSignedDate)
                    {
                        ginApprovalInfoXML +=
                            "<GINApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Value.ToString() + "</ID>" +
                            "<ClientSignedDate>" + ClientSignedDate + "</ClientSignedDate>" +
                            "<ClientSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ClientSignedName>" +
                            "<LICSignedDate>" + LICSignedDate + "</LICSignedDate>" +
                            "<LICSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</LICSignedName>" +
                            "<GINStatusID>" + CalculateGINStatus(gvr) + "</GINStatusID>" +
                            "</GINApprovalItem>";
                    }
                    else
                    {
                        Messages.SetMessage(" Client Signed Date and LIC Signed Date have to greater or equal to Date Issued. on GIN Number" + GINNO, Messages.MessageType.Warning);
                        return;
                    }
                }
            }
            ginApprovalInfoXML += "</GINApproval>";
            GINModel.Approve(ginApprovalInfoXML);
            BindData();

            Messages.SetMessage("The Gin Approved and it is out of unapproved list!", Messages.MessageType.Success);
        }