protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (!ValidationControl())
        {
            return;
        }
        string oldDate = this.txtTransferedDate.Text.Trim();
        string newDate = this.txtDecisionDate.Text.Trim();

        bool Valid = CheckDateIsValid(oldDate, newDate);

        if (Valid)
        {
            List <ATTInvItemsTransfered> LSTItemsTrans = (List <ATTInvItemsTransfered>)Session["ItemsTransfered"];

            foreach (ATTInvItemsTransfered var in LSTItemsTrans)
            {
                var.DecisionDate = txtDecisionDate.Text.Trim();
                var.TransDate    = txtTransferedDate.Text.Trim();
                var.TransORG     = int.Parse(ddlTransfdOrg.SelectedValue);
                var.TransOrgUnit = int.Parse(ddlTransOrgUnit.SelectedValue);
                var.TransVia     = int.Parse(this.txtMediatorEmp.Attributes["EmpID"].ToString());
                var.TransTo      = int.Parse(this.txtTransferedEmp.Attributes["EmpID"].ToString());
                var.EntryBy      = ((ATTUserLogin)Session["Login_User_Detail"]).UserName;
            }

            if (BLLInvItemsTransfered.SaveItemsTransfer(LSTItemsTrans, "transfer"))
            {
                this.lblStatusMessage.Text = "Transfered Items Saved";
                this.programmaticModalPopup.Show();
            }
            Clearcontrols(true);
        }
        else
        {
            this.lblStatusMessage.Text = "Decision Date should be less or equal to Transfered Date";
            this.programmaticModalPopup.Show();
        }
        grdItemsTrans.DataSource = "";
        grdItemsTrans.DataBind();
    }
Ejemplo n.º 2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (ddlItemsType.SelectedIndex == 0)
            {
                this.lblStatusMessage.Text = "समानको किसिम छान्नुहोस्";
                this.programmaticModalPopup.Show();
                return;
            }
            if (this.txtReceivedDate.Text == "")
            {
                this.lblStatusMessage.Text = "बुझिलिएको मिति हाल्नुहोस्";
                this.programmaticModalPopup.Show();
                return;
            }

            List <ATTInvItemsTransfered> lstNew            = new List <ATTInvItemsTransfered>();
            List <ATTInvItemsTransfered> lstItemsTransfKNJ = new List <ATTInvItemsTransfered>();
            List <ATTInvItemsTransfered> lstItemsTransfKBJ = new List <ATTInvItemsTransfered>();
            if (this.ddlItemsType.SelectedIndex == 2)
            {
                lstItemsTransfKNJ = (List <ATTInvItemsTransfered>)Session["ItemsTransfKNJ"];
            }
            else
            {
                lstItemsTransfKBJ = (List <ATTInvItemsTransfered>)Session["ItemsTransfKBJ"];
            }
            ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]);

            if (lstItemsTransfKNJ.Count > 0)
            {
                if (((CheckBox)grdItemsTransfRecv.HeaderRow.FindControl("chkAllItems")).Checked == true)
                {
                    foreach (ATTInvItemsTransfered var in lstItemsTransfKNJ)
                    {
                        var.OrgID              = var.OrgID;
                        var.ItemsCategoryID    = var.ItemsCategoryID;
                        var.ItemsSubCategoryID = var.ItemsSubCategoryID;
                        var.ItemsID            = var.ItemsID;
                        var.TransORG           = var.TransORG;
                        var.TransSEQ           = var.TransSEQ;
                        var.SeqNo              = var.SeqNo;
                        // var.Quantity = var.Quantity;
                        var.DecisionDate   = var.DecisionDate;
                        var.TransDate      = var.TransDate;
                        var.TransVia       = var.TransVia;
                        var.TransOrgUnit   = var.TransOrgUnit;
                        var.TransTo        = var.TransTo;
                        var.TransRecvDate  = this.txtReceivedDate.Text.Trim();
                        var.TransRecvBy    = user.OrgID;
                        var.ReturnBy       = var.ReturnBy;
                        var.ReturnDate     = var.ReturnDate;
                        var.ReturnVia      = var.ReturnVia;
                        var.ReturnRecvBy   = var.ReturnRecvBy;
                        var.ReturnRecvDate = var.ReturnRecvDate;
                        var.Action         = "E";
                    }
                    if (BLLInvItemsTransfered.SaveItemsTransfer(lstItemsTransfKNJ, "receive"))
                    {
                        this.lblStatusMessage.Text = "Received Items Saved";
                        this.programmaticModalPopup.Show();
                        Session["ItemsTransfKNJ"] = null;
                    }
                }
                else
                {
                    int count = 0;
                    foreach (GridViewRow row in grdItemsTransfRecv.Rows)
                    {
                        if (((CheckBox)row.FindControl("chkItems")).Checked == true)
                        {
                            ATTInvItemsTransfered obj = new ATTInvItemsTransfered();
                            obj.OrgID         = int.Parse(row.Cells[1].Text);
                            obj.TransSEQ      = int.Parse(row.Cells[2].Text);
                            obj.TransORG      = int.Parse(row.Cells[3].Text);
                            obj.TransfOrgName = row.Cells[4].Text;
                            //obj.Quantity = int.Parse(row.Cells[5].Text);
                            obj.DecisionDate         = row.Cells[6].Text;
                            obj.TransDate            = row.Cells[7].Text;
                            obj.TransVia             = int.Parse(row.Cells[8].Text);
                            obj.TransOrgUnit         = int.Parse(row.Cells[9].Text);
                            obj.TransTo              = int.Parse(row.Cells[10].Text);
                            obj.ItemsCategoryID      = int.Parse(row.Cells[11].Text);
                            obj.ItemsCategoryName    = row.Cells[12].Text;
                            obj.ItemsSubCategoryID   = int.Parse(row.Cells[13].Text);
                            obj.ItemsSubCategoryName = row.Cells[14].Text;
                            obj.ItemsID              = int.Parse(row.Cells[15].Text);
                            obj.ItemsName            = row.Cells[16].Text;
                            obj.ItemsTypeID          = int.Parse(row.Cells[17].Text);
                            obj.ItemsTypeName        = row.Cells[18].Text;
                            obj.ItemsUnitID          = int.Parse(row.Cells[19].Text);
                            obj.ItemsUnitName        = row.Cells[20].Text;
                            obj.SeqNo          = int.Parse(row.Cells[21].Text);
                            obj.TransRecvBy    = user.OrgID;
                            obj.TransRecvDate  = this.txtReceivedDate.Text.Trim();
                            obj.ReturnBy       = null;
                            obj.ReturnDate     = "";
                            obj.ReturnRecvDate = "";
                            obj.ReturnVia      = null;
                            obj.Action         = "E";
                            lstNew.Add(obj);
                            count++;
                        }
                    }
                    if (BLLInvItemsTransfered.SaveItemsTransfer(lstNew, "receive"))
                    {
                        this.lblStatusMessage.Text = "Received Items Saved";
                        this.programmaticModalPopup.Show();
                        Session["ItemsTransfKNJ"] = null;
                    }
                }
            }
            else if (lstItemsTransfKBJ.Count > 0)
            {
                if (((CheckBox)grdItemsTransfRecv.HeaderRow.FindControl("chkAllItems")).Checked == true)
                {
                    foreach (ATTInvItemsTransfered var in lstItemsTransfKBJ)
                    {
                        var.OrgID              = var.OrgID;
                        var.ItemsCategoryID    = var.ItemsCategoryID;
                        var.ItemsSubCategoryID = var.ItemsSubCategoryID;
                        var.ItemsID            = var.ItemsID;
                        var.TransORG           = var.TransORG;
                        var.TransSEQ           = var.TransSEQ;
                        var.Quantity           = var.Quantity;
                        var.DecisionDate       = var.DecisionDate;
                        var.TransDate          = var.TransDate;
                        var.TransVia           = var.TransVia;
                        var.TransOrgUnit       = var.TransOrgUnit;
                        var.TransTo            = var.TransTo;
                        var.TransRecvDate      = this.txtReceivedDate.Text.Trim();
                        var.TransRecvBy        = user.OrgID;
                        var.ReturnBy           = var.ReturnBy;
                        var.ReturnDate         = var.ReturnDate;
                        var.ReturnVia          = var.ReturnVia;
                        var.ReturnRecvBy       = var.ReturnRecvBy;
                        var.ReturnRecvDate     = var.ReturnRecvDate;
                        var.Action             = "E";
                    }
                    if (BLLInvItemsTransfered.SaveItemsTransfer(lstItemsTransfKBJ, "receive"))
                    {
                        this.lblStatusMessage.Text = "Received Items Saved";
                        this.programmaticModalPopup.Show();
                        Session["ItemsTransfKBJ"] = null;
                    }
                }
                else
                {
                    int count = 0;
                    foreach (GridViewRow row in grdItemsTransfRecv.Rows)
                    {
                        if (((CheckBox)row.FindControl("chkItems")).Checked == true)
                        {
                            ATTInvItemsTransfered obj = new ATTInvItemsTransfered();
                            obj.OrgID                = int.Parse(row.Cells[1].Text);
                            obj.TransSEQ             = int.Parse(row.Cells[2].Text);
                            obj.TransORG             = int.Parse(row.Cells[3].Text);
                            obj.TransfOrgName        = row.Cells[4].Text;
                            obj.Quantity             = int.Parse(row.Cells[5].Text);
                            obj.DecisionDate         = row.Cells[6].Text;
                            obj.TransDate            = row.Cells[7].Text;
                            obj.TransVia             = int.Parse(row.Cells[8].Text);
                            obj.TransOrgUnit         = int.Parse(row.Cells[9].Text);
                            obj.TransTo              = int.Parse(row.Cells[10].Text);
                            obj.ItemsCategoryID      = int.Parse(row.Cells[11].Text);
                            obj.ItemsCategoryName    = row.Cells[12].Text;
                            obj.ItemsSubCategoryID   = int.Parse(row.Cells[13].Text);
                            obj.ItemsSubCategoryName = row.Cells[14].Text;
                            obj.ItemsID              = int.Parse(row.Cells[15].Text);
                            obj.ItemsName            = row.Cells[16].Text;
                            obj.ItemsTypeID          = int.Parse(row.Cells[17].Text);
                            obj.ItemsTypeName        = row.Cells[18].Text;
                            obj.ItemsUnitID          = int.Parse(row.Cells[19].Text);
                            obj.ItemsUnitName        = row.Cells[20].Text;
                            obj.TransRecvBy          = user.OrgID;
                            obj.TransRecvDate        = this.txtReceivedDate.Text.Trim();
                            obj.ReturnBy             = null;
                            obj.ReturnDate           = "";
                            obj.ReturnRecvDate       = "";
                            obj.ReturnVia            = null;
                            obj.Action               = "E";
                            lstNew.Add(obj);
                            count++;
                        }
                    }
                    if (BLLInvItemsTransfered.SaveItemsTransfer(lstNew, "receive"))
                    {
                        this.lblStatusMessage.Text = "Received Items Saved";
                        this.programmaticModalPopup.Show();
                        Session["ItemsTransfKBJ"] = null;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        ClearControls();
    }