Ejemplo n.º 1
0
        public static CaseClass tblCase_GetByStatus(int status)
        {
            string query = "tblCase_GetByStatus";

              List<SqlParameter> prms = new List<SqlParameter>();

              SqlParameter prm = new SqlParameter("@Status", status);
              prms.Add(prm);

              DataTable dt = Connection.runQuery(query, prms.ToArray());

              CaseClass res = new CaseClass();

              for (int i = 0; i < dt.Rows.Count; i++)
              {
            CaseClass tmp = new CaseClass();

            tmp.CasePrmID = Convert.ToInt32(dt.Rows[i]["CasePrmID"].ToString());
            tmp.Parameter = dt.Rows[i]["Parameter"].ToString();
            tmp.Value = Convert.ToDecimal(dt.Rows[i]["Value"].ToString());
            tmp.UnValue = Convert.ToDecimal(dt.Rows[i]["UnValue"].ToString());
            tmp.Status = Convert.ToInt32(dt.Rows[i]["Status"].ToString());
            tmp.GenValue = Convert.ToDecimal(dt.Rows[i]["GenValue"].ToString());
            res = tmp;
              }
              return res;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// i have job to do...
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        public static DataTable MakeReport(DateTime date, CaseClass caseObj)
        {
            string query = "reportFormDoneNew";

              List<SqlParameter> prms = new List<SqlParameter>();

              prms.Add(new SqlParameter("@CustomerID", DBNull.Value));

              prms.Add(new SqlParameter("@StartDate", date.Date));
              prms.Add(new SqlParameter("@EndDate", date.Date));

              prms.Add(new SqlParameter("@ProductId", DBNull.Value));

              DataTable dt = Connection.runQuery(query, prms.ToArray());

              string[] products = Product.Products_GetUsedProducts();

              //new table generations
              DataTable newDt = new DataTable();

              for (int i = 0; i < products.Length; i++)
              {
            DataColumn dataCol = new DataColumn(products[i]);
            newDt.Columns.Add(dataCol);
              }

              DataColumn dataColProductTotalCount = new DataColumn("Toplam");
              newDt.Columns.Add(dataColProductTotalCount);

              DataColumn dataColTotalPrice = new DataColumn("Tutar");
              newDt.Columns.Add(dataColTotalPrice);

              //jobs to do

              //SpecialPrice[] allSpecialPrices = SpecialPrice.SpecialPrice_GetDistincts();

              //for (int i = 0; i < allSpecialPrices.Length;i++ )
              //{
              //   allSpecialPrices[i].

              //  DataColumn dcsp = new DataColumn("");

              //}

              //filling newDt table for.
              for (int i = 0; i < dt.Rows.Count; i++)
              {

            DataRow dtr = newDt.NewRow();
            int oID = Convert.ToInt32(dt.Rows[i]["ID"].ToString());

            dtr["Müşteri Adı"] = Customer.Customer_GetByID(Convert.ToInt32(dt.Rows[i]["CustomerID"].ToString())).Name;

            OrderDetail[] ods = OrderDetail.OrderDetails_GetByOrderID(oID).ToArray();

            for (int j = 0; j < ods.Length; j++)
            {
              for (int k = 0; k < newDt.Columns.Count; k++)
              {
            Product pTmp = Product.Products_GetByID(ods[j].ProductID);
            if (newDt.Columns[k].ColumnName == pTmp.Name)
            {
              dtr[k] = ods[j].Unit;
              dtr[k + 1] = ods[j].Price;
            }
              }

            }

            dtr["Sipariş Tarihi"] = dt.Rows[i]["Date"].ToString();

            newDt.Rows.Add(dtr);
              }

              return newDt;
        }
Ejemplo n.º 3
0
        public static CaseClass[] tblCase_GetAll()
        {
            string query = "tblCase_GetAll";

              DataTable dt = Connection.runQuery(query, new SqlParameter[0]);

              List<CaseClass> res = new List<CaseClass>();

              for (int i = 0; i < dt.Rows.Count; i++)
              {
            CaseClass tmp = new CaseClass();

            tmp.CasePrmID = Convert.ToInt32(dt.Rows[i]["CasePrmID"].ToString());
            tmp.Parameter = dt.Rows[i]["Parameter"].ToString();
            tmp.Value = Convert.ToDecimal(dt.Rows[i]["Value"].ToString());
            tmp.UnValue = Convert.ToDecimal(dt.Rows[i]["UnValue"].ToString());
            tmp.Status = Convert.ToInt32(dt.Rows[i]["Status"].ToString());
            tmp.GenValue = Convert.ToDecimal(dt.Rows[i]["GenValue"].ToString());
            res.Add(tmp);
              }
              return res.ToArray();
        }