Пример #1
0
        private DataTable GetDataSet1()
        {
            //SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["A2ZRetailConnectionString"].ConnectionString);
            SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["RetailManagementConnectionString"].ConnectionString);
            // SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=" + DatabaseName + ";Integrated Security=True");
            string         ChallanNo       = Session["ChallanNo"].ToString();
            SqlDataAdapter adp             = new SqlDataAdapter("select * from DeliveryChallanItems where ChallanNo='" + ChallanNo + "'", con);
            DeliveryChallanItemsDataSet ds = new DeliveryChallanItemsDataSet();

            con.Open();
            adp.Fill(ds);
            return(ds.Tables[1]);
        }
        private DataTable GetDataSet1()
        {
            SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["RetailManagementConnectionString"].ConnectionString);
            // SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=" + DatabaseName + ";Integrated Security=True");
            string         ChallanNo       = Session["ChallanNo"].ToString();
            SqlDataAdapter adp             = new SqlDataAdapter("select * from DeliveryChallanItems where ChallanNo='" + ChallanNo + "'", con);
            DeliveryChallanItemsDataSet ds = new DeliveryChallanItemsDataSet();

            con.Open();
            adp.Fill(ds);
            double?TotalAmount   = 0;
            double?TotalDiscount = 0;

            for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
            {
                double?discountonmrp = ((Convert.ToDouble(ds.Tables[1].Rows[i]["Quantity"])) * (Convert.ToDouble(ds.Tables[1].Rows[i]["MRP"]))) * Convert.ToDouble(ds.Tables[1].Rows[i]["DiscountPercent"]) / 100;
                TotalDiscount = TotalDiscount + discountonmrp;
                TotalAmount   = TotalAmount + ((Convert.ToDouble(ds.Tables[1].Rows[i]["Quantity"])) * (Convert.ToDouble(ds.Tables[1].Rows[i]["MRP"]))) - discountonmrp;
            }
            Session["TotalAmount"]   = TotalAmount;
            Session["TotalDiscount"] = TotalDiscount;
            return(ds.Tables[1]);
        }