Exemple #1
0
        protected void GRNApprovalEdit()
        {
            string dateEntered;
            string timeEntered;
            Guid   GRNNo;
            string GRN_No;
            int    response;

            Messages1.ClearMessage();
            int countError = 0;

            dateEntered = ((TextBox)grvGRNApproval.Rows[0].FindControl("txtDateTimeLICSigned")).Text;
            timeEntered = ((TextBox)grvGRNApproval.Rows[0].FindControl("txtTimeLICSigned")).Text;
            GRNNo       = new Guid(grvGRNApproval.DataKeys[0].Value.ToString());
            GRN_No      = ((Label)grvGRNApproval.Rows[0].FindControl("lblGRNNo")).Text;
            response    = int.Parse(((DropDownList)grvGRNApproval.Rows[0].FindControl("drpLICStatus")).SelectedValue);

            if (dateEntered == "" || timeEntered == "")
            {
                Messages1.SetMessage("Enter values to GRN No: <b>" + GRN_No + "</b><br/>", WarehouseApplication.Messages.MessageType.Warning);
                countError++;
            }

            if (countError == 0)
            {
                try
                {
                    GRNApprovalModel.UpdateGRNSupervisorApproval(GRNNo, UserBLL.CurrentUser.UserId, response, (DateTime.Parse(dateEntered + " " + timeEntered)), DateTime.Now);

                    // if Superevisor Accept it create WarehouseReciept....
                    if (response == 1)
                    {
                        GRN_BL objGrnNew          = new GRN_BL();
                        GRNBLL objGrnOld          = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No);
                        WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);
                        objWR.Save();
                    }

                    BindGRNApprovalGridviewForEdit();
                    Messages1.SetMessage("Updated successfully.", Messages.MessageType.Success);
                }
                catch (Exception ex)
                {
                    Messages1.SetMessage(ex.Message, Messages.MessageType.Error);
                }
            }
            else
            {
                btnApprove.Style["visibility"] = "visible";
            }
        }
Exemple #2
0
        protected void GRNApprovalBySupervisor()
        {
            string dateEntered;
            string timeEntered;
            string GRNNo;
            string GRN_No;
            int    response;

            Messages1.ClearMessage();
            int countError = 0;

            string GRNApprovalXML = "<GRNApproval>";

            foreach (GridViewRow gvr in this.grvGRNApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    // check if date and time is not empty
                    dateEntered = ((TextBox)grvGRNApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned")).Text;
                    timeEntered = ((TextBox)grvGRNApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned")).Text;
                    GRNNo       = grvGRNApproval.DataKeys[gvr.RowIndex].Value.ToString();
                    GRN_No      = ((Label)grvGRNApproval.Rows[gvr.RowIndex].FindControl("lblGRNNo")).Text;
                    response    = int.Parse(((DropDownList)grvGRNApproval.Rows[0].FindControl("drpLICStatus")).SelectedValue);

                    // if Superevisor Accept it create WarehouseReciept....
                    if (response == 1)
                    {
                        GRN_BL objGrnNew          = new GRN_BL();
                        GRNBLL objGrnOld          = objGrnNew.GetWarehouseReciptByGRNNumber(GRN_No);
                        WarehouseRecieptBLL objWR = new WarehouseRecieptBLL(objGrnOld);
                        objWR.Save();
                    }

                    if (dateEntered == "" || timeEntered == "")
                    {
                        Messages1.SetMessage("Enter values to GRN No: <b>" + GRN_No + "</b><br/>", WarehouseApplication.Messages.MessageType.Warning);
                        countError++;
                    }
                    if (countError == 0)
                    {
                        GRNApprovalXML +=
                            "<GRNApprovalItem> <ID>" + GRNNo + "</ID>" +
                            "<WarehouseSupervisorApprovedBy>" + UserBLL.CurrentUser.UserId + "</WarehouseSupervisorApprovedBy>" +
                            "<WarehouseSupervisorApprovedDateTime>" + dateEntered + " " + timeEntered + "</WarehouseSupervisorApprovedDateTime>" +
                            "<WarehouseSupervisorApprovedTimeStamp>" + DateTime.Now + "</WarehouseSupervisorApprovedTimeStamp>" +
                            "<WarehouseSupervisorStatus>" + response + "</WarehouseSupervisorStatus>" +
                            "<Status>" + 3 + "</Status>" +
                            "<StackID>" + ((Label)grvGRNApproval.Rows[gvr.RowIndex].FindControl("lblStackID")).Text + "</StackID>" +
                            "</GRNApprovalItem>";
                    }
                }
            }
            if (countError == 0)
            {
                try
                {
                    GRNApprovalXML += "</GRNApproval>";
                    GRNApprovalModel.ApproveGRNBySupervisor(GRNApprovalXML);
                    BindGRNApprovalGridview();
                    Messages1.SetMessage("Approved successfully.", Messages.MessageType.Success);
                    BindLIC(status);
                }
                catch (Exception ex)
                {
                    Messages1.SetMessage(ex.Message, Messages.MessageType.Error);
                }
            }
            else
            {
                btnApprove.Style["visibility"] = "visible";
            }
        }