コード例 #1
0
        private void GetOrderList()
        {
            List <orderlist> oRList = new List <orderlist>();

            string sql = $@"SELECT i_cust as t_cust, SUM(i_damt) as t_damt, MAX(C_NAME) as t_name, MAX(C_ADDRESS) as t_address,
                            MAX(C_CITY) as t_city, MAX(C_TEL) as t_tel, MAX(i_user) as t_suser FROM CART LEFT OUTER JOIN CUST ON cart.i_cust = CUST.C_ID
                            GROUP BY cart.i_cust 
                            ORDER BY i_cust";

            var rd = LocalDb.db.QueryAsync <tmp_orderlist>(sql).Result.ToList();

            if (rd != null || rd.Count() != 0)
            {
                foreach (tmp_orderlist tmp in rd)
                {
                    orderlist h = new orderlist();

                    h.ol_cust    = tmp.t_cust;
                    h.ol_custn   = tmp.t_name;
                    h.ol_suser   = tmp.t_suser;
                    h.ol_custadd = $@"{tmp.t_address.Trim()} {tmp.t_city.Trim()} {tmp.t_tel.Trim()}";
                    h.ol_damt    = tmp.t_damt;

                    oRList.Add(h);
                }

                ItemOrderList.ItemsSource = string.Empty;
                ItemOrderList.ItemsSource = oRList;
            }
        }
コード例 #2
0
        public async Task <ActionResult <orderlist> > Postorderlist(orderlist orderlist)
        {
            _context.orderlists.Add(orderlist);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(Getorderlist), new { id = orderlist.OrderID }, orderlist));
        }
コード例 #3
0
        public async Task <IActionResult> Putorderlist(int id, orderlist orderlist)
        {
            if (id != orderlist.OrderID)
            {
                return(BadRequest());
            }

            _context.Entry(orderlist).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!orderlistExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #4
0
 public void Delete(orderlist item)
 {
     _orderlistRepository.Delete(item);
 }
コード例 #5
0
 public void Update(orderlist item)
 {
     _orderlistRepository.Update(item);
 }
コード例 #6
0
 public void Create(orderlist item)
 {
     _orderlistRepository.Add(item);
 }
コード例 #7
0
    public void order_detail_inner(HtmlGenericControl divcollapse_inner, string order_id, string sendprice, string totalprice)
    {
        orderlist          orlist        = new orderlist();
        category           cat           = new category();
        brand              brnd          = new brand();
        DataTable          product_order = orlist.get_product_order(order_id);
        products           pro           = new products();
        HtmlGenericControl table_order   = new HtmlGenericControl("table");

        table_order.Attributes.Add("class", "table table-items");
        HtmlGenericControl table_head    = new HtmlGenericControl("thead");
        HtmlGenericControl tr_table_head = new HtmlGenericControl("tr");

        HtmlGenericControl th_name_tr_table_head = new HtmlGenericControl("th");

        th_name_tr_table_head.Attributes.Add("colspan", "2");
        th_name_tr_table_head.InnerHtml = "مشخصات محصول";
        tr_table_head.Controls.Add(th_name_tr_table_head);

        HtmlGenericControl th_number_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_number_tr_table_head = new HtmlGenericControl("div");

        div_th_number_tr_table_head.Attributes.Add("class", "align-center");
        div_th_number_tr_table_head.InnerText = "تعداد";
        th_number_tr_table_head.Controls.Add(div_th_number_tr_table_head);
        tr_table_head.Controls.Add(th_number_tr_table_head);

        HtmlGenericControl th_unitprice_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_unitprice_tr_table_head = new HtmlGenericControl("div");

        div_th_unitprice_tr_table_head.Attributes.Add("class", "align-right");
        div_th_unitprice_tr_table_head.InnerText = "قیمت واحد";
        th_unitprice_tr_table_head.Controls.Add(div_th_unitprice_tr_table_head);
        tr_table_head.Controls.Add(th_unitprice_tr_table_head);

        HtmlGenericControl th_price_tr_table_head     = new HtmlGenericControl("th");
        HtmlGenericControl div_th_price_tr_table_head = new HtmlGenericControl("div");

        div_th_price_tr_table_head.Attributes.Add("class", "align-right");
        div_th_price_tr_table_head.InnerText = "قیمت کل";
        th_price_tr_table_head.Controls.Add(div_th_price_tr_table_head);
        tr_table_head.Controls.Add(th_price_tr_table_head);


        table_head.Controls.Add(tr_table_head);
        table_order.Controls.Add(table_head);


        HtmlGenericControl table_body_order = new HtmlGenericControl("tbody");
        int total_price = 0;

        foreach (DataRow dr in product_order.Rows)
        {
            string             catname   = cat.getcategory(dr["cat_id"].ToString()).Rows[0]["name"].ToString();
            string             brandname = brnd.getbrandbyid(dr["brand_id"].ToString()).Rows[0]["name"].ToString();
            DataTable          pic       = pro.getonepic(int.Parse(dr["product_id"].ToString()));
            HtmlGenericControl tr        = new HtmlGenericControl("tr");
            HtmlGenericControl tdimg     = new HtmlGenericControl("td");
            tdimg.Attributes.Add("class", "image");
            HtmlGenericControl img = new HtmlGenericControl("img");
            img.Attributes.Add("src", "images/Ppic/" + pic.Rows[0]["name"].ToString() + ".jpg");
            img.Attributes.Add("alt", "");
            img.Attributes.Add("width", "50");
            img.Attributes.Add("height", "50");
            tdimg.Controls.Add(img);
            tr.Controls.Add(tdimg);//finish td img

            HtmlGenericControl tddesc = new HtmlGenericControl("td");
            tddesc.Attributes.Add("class", "desc");
            tddesc.InnerText = catname + "-" + brandname + " - " + dr["name"].ToString();


            tr.Controls.Add(tddesc);//finish td by class desc

            HtmlGenericControl tdqty = new HtmlGenericControl("td");
            tdqty.Attributes.Add("class", "qty");
            HtmlGenericControl divnumber = new HtmlGenericControl("div");
            divnumber.Attributes.Add("class", "numbered");
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            divnumber.Controls.Add(new LiteralControl("&nbsp;"));
            //HtmlInputText input = new HtmlInputText();
            HtmlGenericControl input = new HtmlGenericControl("input");
            input.Attributes.Add("name", "input_number" + dr["id"].ToString());
            input.Attributes.Add("class", "tiny-size");
            input.Attributes.Add("value", dr["count"].ToString());
            input.Attributes.Add("type", "text");
            input.Attributes.Add("readonly", "readonly");
            input.Attributes.Add("id", "input_number" + dr["id"].ToString());
            divnumber.Controls.Add(input); //finish input
            tdqty.Controls.Add(divnumber);
            tr.Controls.Add(tdqty);        //finish td by class qty

            HtmlGenericControl td_unit_price = new HtmlGenericControl("td");
            td_unit_price.Attributes.Add("class", "price");
            td_unit_price.InnerText = dr["price"].ToString() + "  ریال  ";
            tr.Controls.Add(td_unit_price);//finish td price

            HtmlGenericControl tdprice = new HtmlGenericControl("td");
            tdprice.Attributes.Add("class", "price");
            tdprice.InnerText = ((Int32)dr["price"] * (Int16)dr["count"]).ToString() + "  ریال  ";
            tr.Controls.Add(tdprice);//finish td price
            table_body_order.Controls.Add(tr);
            total_price += (Int32)dr["price"] * (Int16)dr["count"];
        }


        HtmlGenericControl tr_send_price = new HtmlGenericControl("tr");
        HtmlGenericControl td_space      = new HtmlGenericControl("td");

        td_space.Attributes.Add("colspan", "3");
        td_space.Attributes.Add("rowspan", "3");
        td_space.Controls.Add(new LiteralControl("&nbsp;"));
        tr_send_price.Controls.Add(td_space);

        HtmlGenericControl td_stronger_lable = new HtmlGenericControl("td");

        td_stronger_lable.Attributes.Add("class", "stronger");
        td_stronger_lable.InnerText = "هزينه ارسال :";
        tr_send_price.Controls.Add(td_stronger_lable);


        HtmlGenericControl td_stronger_price = new HtmlGenericControl("td");

        td_stronger_price.Attributes.Add("class", "stronger");
        HtmlGenericControl div_td_stronger_price = new HtmlGenericControl("div");

        div_td_stronger_price.Attributes.Add("class", "align-right");
        div_td_stronger_price.InnerText = sendprice + " ریال";
        td_stronger_price.Controls.Add(div_td_stronger_price);
        tr_send_price.Controls.Add(td_stronger_price);
        table_body_order.Controls.Add(tr_send_price);

        HtmlGenericControl tr_total_price = new HtmlGenericControl("tr");
        HtmlGenericControl td_stronger_lable_totalprice = new HtmlGenericControl("td");

        td_stronger_lable_totalprice.Attributes.Add("class", "stronger");
        td_stronger_lable_totalprice.InnerText = "جمع کل :";
        tr_total_price.Controls.Add(td_stronger_lable_totalprice);


        HtmlGenericControl td_stronger_totalprice = new HtmlGenericControl("td");

        td_stronger_totalprice.Attributes.Add("class", "stronger");
        HtmlGenericControl div_td_stronger_totalprice = new HtmlGenericControl("div");

        div_td_stronger_totalprice.Attributes.Add("class", "size-16 align-right");
        div_td_stronger_totalprice.InnerText = total_price + " ریال";
        td_stronger_totalprice.Controls.Add(div_td_stronger_totalprice);
        tr_total_price.Controls.Add(td_stronger_totalprice);
        table_body_order.Controls.Add(tr_total_price);


        table_order.Controls.Add(table_body_order);
        divcollapse_inner.Controls.Add(table_order);
    }