Ejemplo n.º 1
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            string errmsg = string.Empty;

            try
            {
                BALTransferIn objtransferin = new BALTransferIn();
                Functions     objfun        = new Functions();
                string        meditem       = string.Empty;
                int           ReviewCount   = grdtransferinreview.Rows.Count;
                if (ReviewCount != 0)
                {
                    foreach (GridViewRow row in grdtransferinreview.Rows)
                    {
                        try
                        {
                            #region multi order generation start
                            objtransferin.TransferOutID    = Convert.ToInt64(row.Cells[0].Text);
                            objtransferin.TransferNo       = row.Cells[1].Text;
                            objtransferin.TransferOutDate  = Convert.ToDateTime(row.Cells[2].Text);
                            objtransferin.CorporateIDfrom  = Convert.ToInt64(row.Cells[3].Text);
                            objtransferin.CorporateIDTo    = Convert.ToInt64(row.Cells[4].Text);
                            objtransferin.FacilityIDFrom   = Convert.ToInt64(row.Cells[5].Text);
                            objtransferin.FacilityIDTo     = Convert.ToInt64(row.Cells[6].Text);
                            objtransferin.FacilityFromName = row.Cells[7].Text;
                            objtransferin.ItemID           = Convert.ToInt64(row.Cells[8].Text);
                            objtransferin.CategoryID       = Convert.ToInt64(row.Cells[9].Text);
                            objtransferin.ItemDescription  = HttpUtility.HtmlDecode(row.Cells[11].Text);
                            objtransferin.QtyPack          = Convert.ToInt64(row.Cells[12].Text);
                            objtransferin.UOMID            = Convert.ToInt64(row.Cells[13].Text);
                            string Price    = row.Cells[15].Text;
                            string Subprice = Price.Substring(1);
                            objtransferin.Price = Convert.ToDecimal(Subprice);
                            //objtransferin.Price = Convert.ToDecimal(row.Cells[15].Text);
                            objtransferin.Transferqty = Convert.ToInt64(row.Cells[16].Text);
                            string TotalPrice    = row.Cells[17].Text;
                            string SubTotalprice = TotalPrice.Substring(1);
                            objtransferin.TotalPrice = Convert.ToDecimal(SubTotalprice);
                            objtransferin.Status     = row.Cells[19].Text;
                            objtransferin.LoggedinBy = defaultPage.UserId;
                            meditem = lclsservice.InsertTransferIn(objtransferin);
                            #endregion multi order generation end
                        }
                        catch (Exception innerce)
                        {
                            errmsg = errmsg + "Error in TransferID[" + objtransferin.TransferNo + "] - " + innerce.Message.ToString();
                        }
                    }
                    if (errmsg != string.Empty)
                    {
                        throw new Exception(errmsg);
                    }
                    if (meditem == "Saved Successfully")
                    {
                        BindGrid();
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.TransferInSaveMsg.Replace("<<TransferInDescription>>", ""), true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningTransferInNoRecord.Replace("<<TransferInDescription>>", ""), true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.TransferInErrorMessage.Replace("<<TransferInDescription>>", ex.Message), true);
            }
        }
Ejemplo n.º 2
0
        public List <object> PrintTransferIn()
        {
            List <object> llstarg = new List <object>();
            //List<BindTransferInReport> llstreview = lclsservice.BindTransferInReport(defaultPage.UserId).ToList();
            BALTransferIn objbaltransferin = new BALTransferIn();

            if (drpcorsearch.SelectedValue == "All")
            {
                objbaltransferin.ListCorporateID = "ALL";
            }
            else
            {
                foreach (ListItem lst in drpcorsearch.Items)
                {
                    if (lst.Selected && drpcorsearch.SelectedValue != "All")
                    {
                        SB.Append(lst.Value + ',');
                    }
                }
                if (SB.Length > 0)
                {
                    FinalString = SB.ToString().Substring(0, (SB.Length - 1));
                }

                objbaltransferin.ListCorporateID = FinalString;
            }
            FinalString = "";
            SB.Clear();
            if (drpfacilitysearch.SelectedValue == "All")
            {
                objbaltransferin.ListFacilityID = "ALL";
            }
            else
            {
                foreach (ListItem lst in drpfacilitysearch.Items)
                {
                    if (lst.Selected && drpfacilitysearch.SelectedValue != "All")
                    {
                        SB.Append(lst.Value + ',');
                    }
                }
                if (SB.Length > 0)
                {
                    FinalString = SB.ToString().Substring(0, (SB.Length - 1));
                }
                objbaltransferin.ListFacilityID = FinalString;
            }
            FinalString = "";
            SB.Clear();
            if (drpcategorysearch.SelectedValue == "All")
            {
                objbaltransferin.ListCategoryID = "ALL";
            }
            else
            {
                foreach (ListItem lst in drpcategorysearch.Items)
                {
                    if (lst.Selected)
                    {
                        SB.Append(lst.Value + ',');
                    }
                }
                if (SB.Length > 0)
                {
                    FinalString = SB.ToString().Substring(0, (SB.Length - 1));
                }
                objbaltransferin.ListCategoryID = FinalString;
            }
            SB.Clear();
            if (drpStatussearch.SelectedValue == "All")
            {
                objbaltransferin.Status = "ALL";
            }
            else
            {
                foreach (ListItem lst in drpStatussearch.Items)
                {
                    if (lst.Selected)
                    {
                        SB.Append(lst.Value + ',');
                    }
                }
                if (SB.Length > 0)
                {
                    FinalString = SB.ToString().Substring(0, (SB.Length - 1));
                }
                objbaltransferin.Status = FinalString;
            }
            SB.Clear();
            if (txtDateFrom.Text == "")
            {
                DateTime firstDayLastMonth = DateTime.Now.AddDays(1 - DateTime.Now.Day).AddMonths(-1);
                txtDateFrom.Text = firstDayLastMonth.ToString("MM/dd/yyyy");
            }
            else
            {
                objbaltransferin.DateFrom = Convert.ToDateTime(txtDateFrom.Text);
            }
            if (txtDateTo.Text == "")
            {
                txtDateTo.Text = DateTime.Now.ToString("MM/dd/yyyy");
            }
            else
            {
                objbaltransferin.DateTo = Convert.ToDateTime(txtDateTo.Text);
            }
            objbaltransferin.LoggedinBy = defaultPage.UserId;
            List <SearchTransferIn> llstreview = lclsservice.SearchTransferIn(objbaltransferin).ToList();

            rvTransferInReport.ProcessingMode         = ProcessingMode.Local;
            rvTransferInReport.LocalReport.ReportPath = Server.MapPath("~/Reports/TransferInSummary.rdlc");
            ReportDataSource datasource = new ReportDataSource("TransferInSummaryDS", llstreview);

            rvTransferInReport.LocalReport.DataSources.Clear();
            rvTransferInReport.LocalReport.DataSources.Add(datasource);
            rvTransferInReport.LocalReport.Refresh();
            Warning[] warnings;
            string[]  streamids;
            string    mimeType;
            string    encoding;
            string    extension;

            byte[] bytes = null;
            bytes = rvTransferInReport.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings);
            llstarg.Insert(0, bytes);
            return(llstarg);
        }
Ejemplo n.º 3
0
        public void BindGrid()
        {
            try
            {
                BALTransferIn objbaltransferin = new BALTransferIn();

                if (drpcorsearch.SelectedValue == "All")
                {
                    objbaltransferin.ListCorporateID = "ALL";
                }
                else
                {
                    foreach (ListItem lst in drpcorsearch.Items)
                    {
                        if (lst.Selected && drpcorsearch.SelectedValue != "All")
                        {
                            SB.Append(lst.Value + ',');
                        }
                    }
                    if (SB.Length > 0)
                    {
                        FinalString = SB.ToString().Substring(0, (SB.Length - 1));
                    }

                    objbaltransferin.ListCorporateID = FinalString;
                }
                FinalString = "";
                SB.Clear();
                if (drpfacilitysearch.SelectedValue == "All")
                {
                    objbaltransferin.ListFacilityID = "ALL";
                }
                else
                {
                    foreach (ListItem lst in drpfacilitysearch.Items)
                    {
                        if (lst.Selected && drpfacilitysearch.SelectedValue != "All")
                        {
                            SB.Append(lst.Value + ',');
                        }
                    }
                    if (SB.Length > 0)
                    {
                        FinalString = SB.ToString().Substring(0, (SB.Length - 1));
                    }
                    objbaltransferin.ListFacilityID = FinalString;
                }
                FinalString = "";
                SB.Clear();
                if (drpcategorysearch.SelectedValue == "All")
                {
                    objbaltransferin.ListCategoryID = "ALL";
                }
                else
                {
                    foreach (ListItem lst in drpcategorysearch.Items)
                    {
                        if (lst.Selected)
                        {
                            SB.Append(lst.Value + ',');
                        }
                    }
                    if (SB.Length > 0)
                    {
                        FinalString = SB.ToString().Substring(0, (SB.Length - 1));
                    }
                    objbaltransferin.ListCategoryID = FinalString;
                }
                SB.Clear();
                if (drpStatussearch.SelectedValue == "All")
                {
                    objbaltransferin.Status = "ALL";
                }
                else
                {
                    foreach (ListItem lst in drpStatussearch.Items)
                    {
                        if (lst.Selected)
                        {
                            SB.Append(lst.Value + ',');
                        }
                    }
                    if (SB.Length > 0)
                    {
                        FinalString = SB.ToString().Substring(0, (SB.Length - 1));
                    }
                    objbaltransferin.Status = FinalString;
                }
                SB.Clear();
                if (txtDateFrom.Text == "")
                {
                    DateTime firstDayLastMonth = DateTime.Now.AddDays(1 - DateTime.Now.Day).AddMonths(-1);
                    txtDateFrom.Text = firstDayLastMonth.ToString("MM/dd/yyyy");
                }
                else
                {
                    objbaltransferin.DateFrom = Convert.ToDateTime(txtDateFrom.Text);
                }
                if (txtDateTo.Text == "")
                {
                    txtDateTo.Text = DateTime.Now.ToString("MM/dd/yyyy");
                }
                else
                {
                    objbaltransferin.DateTo = Convert.ToDateTime(txtDateTo.Text);
                }
                objbaltransferin.LoggedinBy = defaultPage.UserId;
                List <SearchTransferIn> lstTRIMaster = lclsservice.SearchTransferIn(objbaltransferin).ToList();
                grdtransferinsearch.DataSource = lstTRIMaster;
                grdtransferinsearch.DataBind();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.TransferInErrorMessage.Replace("<<TransferInDescription>>", ex.Message), true);
            }
        }