Beispiel #1
0
        protected void lvOrderMaterial_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem currentItem   = (ListViewDataItem)e.Item;
                OrderMaterial    orderMaterial = (OrderMaterial)((ListViewDataItem)(e.Item)).DataItem;

                Label lblOrderNo          = (Label)currentItem.FindControl("lblOrderNo");
                Label lblOrderID          = (Label)currentItem.FindControl("lblOrderID");
                Label lblMaterialCode     = (Label)currentItem.FindControl("lblMaterialCode");
                Label lblMaterialQuantity = (Label)currentItem.FindControl("lblMaterialQuantity");
                Label lblMaterialOutDate  = (Label)currentItem.FindControl("lblMaterialOutDate");
                Label lblMaterialUnit     = (Label)currentItem.FindControl("lblMaterialUnit");

                //lvRowCount += 1;
                Label lblSerialNo = (Label)currentItem.FindControl("lblSerialNo");
                //lblSerialNo.Text = lvRowCount.ToString();

                lblOrderNo.Text          = orderMaterial.OrderNo;
                lblOrderID.Text          = orderMaterial.OrderID.ToString();
                lblMaterialCode.Text     = orderMaterial.MaterialCode;
                lblMaterialQuantity.Text = orderMaterial.MaterialQuantity.ToString();
                lblMaterialOutDate.Text  = orderMaterial.OrderMaterialDate.ToString("dd/MM/yyyy");
                lblorderIdHidden.Text    = lblOrderID.Text;
                lblMaterialUnit.Text     = orderMaterial.MaterialUnit.ToString();
            }
        }
Beispiel #2
0
        private void chkNull(OrderMaterial p)
        {
            long    chk  = 0;
            Decimal chk1 = 0;

            p.date_modi   = p.date_modi == null ? "" : p.date_modi;
            p.date_cancel = p.date_cancel == null ? "" : p.date_cancel;
            p.user_create = p.user_create == null ? "" : p.user_create;
            p.user_modi   = p.user_modi == null ? "" : p.user_modi;
            p.user_cancel = p.user_cancel == null ? "" : p.user_cancel;
            p.host_id     = p.host_id == null ? "" : p.host_id;
            p.branch_id   = p.branch_id == null ? "" : p.branch_id;
            p.device_id   = p.device_id == null ? "" : p.device_id;

            p.material_name = p.material_name == null ? "" : p.material_name;
            p.weight        = p.weight == null ? "" : p.weight;

            p.remark = p.remark == null ? "" : p.remark;

            p.foods_id          = long.TryParse(p.foods_id, out chk) ? chk.ToString() : "0";
            p.material_id       = long.TryParse(p.material_id, out chk) ? chk.ToString() : "0";
            p.order_id          = long.TryParse(p.order_id, out chk) ? chk.ToString() : "0";
            p.foods_material_id = long.TryParse(p.foods_material_id, out chk) ? chk.ToString() : "0";
            //p.sort1 = long.TryParse(p.sort1, out chk) ? chk.ToString() : "999999999";
            //p.sort1 = long.TryParse(p.sort1, out chk) ? chk.ToString() : "999999999";

            p.price  = Decimal.TryParse(p.price, out chk1) ? chk1.ToString() : "0";
            p.weight = Decimal.TryParse(p.weight, out chk1) ? chk1.ToString() : "0";
            p.qty    = Decimal.TryParse(p.qty, out chk1) ? chk1.ToString() : "0";
        }
Beispiel #3
0
        private void initConfig()
        {
            lfootp = new List <OrderMaterial>();
            foom   = new OrderMaterial();
            foom.order_material_id = "order_material_id";
            foom.weight            = "weight";
            foom.material_name     = "material_name";
            foom.active            = "active";
            foom.remark            = "remark";
            foom.sort1             = "sort1";
            foom.date_cancel       = "date_cancel";
            foom.date_create       = "date_create";
            foom.date_modi         = "date_modi";
            foom.user_cancel       = "user_cancel";
            foom.user_create       = "user_create";
            foom.user_modi         = "user_modi";
            foom.host_id           = "host_id";
            foom.branch_id         = "branch_id";
            foom.device_id         = "device_id";
            foom.price             = "price";
            foom.foods_id          = "foods_id";
            foom.qty               = "qty";
            foom.order_id          = "order_id";
            foom.foods_material_id = "foods_material_id";
            foom.foods_name        = "foods_name";
            //foom.foods_id = "foods_id";
            foom.material_id = "material_id";

            foom.pkField = "order_material_id";
            foom.table   = "b_foods_material";
        }
Beispiel #4
0
        private OrderMaterial setFoodsMaterial(DataTable dt)
        {
            OrderMaterial dept1 = new OrderMaterial();

            if (dt.Rows.Count > 0)
            {
                dept1.order_material_id = dt.Rows[0][foom.order_material_id].ToString();
                dept1.weight            = dt.Rows[0][foom.weight].ToString();
                dept1.material_name     = dt.Rows[0][foom.material_name].ToString();
                dept1.foods_id          = dt.Rows[0][foom.foods_id] != null ? dt.Rows[0][foom.foods_id].ToString() : "";
                dept1.weight            = dt.Rows[0][foom.weight] != null ? dt.Rows[0][foom.weight].ToString() : "";
                dept1.remark            = dt.Rows[0][foom.remark] != null ? dt.Rows[0][foom.remark].ToString() : "";
                dept1.date_create       = dt.Rows[0][foom.date_create] != null ? dt.Rows[0][foom.date_create].ToString() : "";
                dept1.date_modi         = dt.Rows[0][foom.date_modi] != null ? dt.Rows[0][foom.date_modi].ToString() : "";
                dept1.date_cancel       = dt.Rows[0][foom.date_cancel] != null ? dt.Rows[0][foom.date_cancel].ToString() : "";
                dept1.user_create       = dt.Rows[0][foom.user_create] != null ? dt.Rows[0][foom.user_create].ToString() : "";
                dept1.user_modi         = dt.Rows[0][foom.user_modi] != null ? dt.Rows[0][foom.user_modi].ToString() : "";
                dept1.user_cancel       = dt.Rows[0][foom.user_cancel] != null ? dt.Rows[0][foom.user_cancel].ToString() : "";
                dept1.active            = dt.Rows[0][foom.active] != null ? dt.Rows[0][foom.active].ToString() : "";
                dept1.sort1             = dt.Rows[0][foom.sort1] != null ? dt.Rows[0][foom.sort1].ToString() : "";
                dept1.price             = dt.Rows[0][foom.price] != null ? dt.Rows[0][foom.price].ToString() : "";
                dept1.qty               = dt.Rows[0][foom.qty] != null ? dt.Rows[0][foom.qty].ToString() : "";
                dept1.material_id       = dt.Rows[0][foom.material_id] != null ? dt.Rows[0][foom.material_id].ToString() : "";
                dept1.host_id           = dt.Rows[0][foom.host_id] != null ? dt.Rows[0][foom.host_id].ToString() : "";
                dept1.device_id         = dt.Rows[0][foom.device_id] != null ? dt.Rows[0][foom.device_id].ToString() : "";
                dept1.order_id          = dt.Rows[0][foom.order_id] != null ? dt.Rows[0][foom.order_id].ToString() : "";
                dept1.foods_material_id = dt.Rows[0][foom.foods_material_id] != null ? dt.Rows[0][foom.foods_material_id].ToString() : "";
                dept1.foods_name        = dt.Rows[0][foom.foods_name] != null ? dt.Rows[0][foom.foods_name].ToString() : "";
            }
            else
            {
                dept1.order_material_id = "";
                dept1.weight            = "";
                dept1.material_name     = "";
                dept1.foods_id          = "";
                dept1.remark            = "";
                dept1.date_create       = "";
                dept1.date_modi         = "";
                dept1.date_cancel       = "";
                dept1.user_create       = "";
                dept1.user_modi         = "";
                dept1.user_cancel       = "";
                dept1.active            = "";
                dept1.sort1             = "";
                dept1.price             = "";
                dept1.host_id           = "";
                dept1.branch_id         = "";
                dept1.qty               = "";
                dept1.device_id         = "";
                dept1.material_id       = "";
                dept1.order_id          = "";
                dept1.foods_material_id = "";
                dept1.foods_name        = "";
            }

            return(dept1);
        }
Beispiel #5
0
        protected void btnSaveOrderMaterial_Click(object sender, EventArgs e)
        {
            List <OrderMaterial> orderMaterialList = new List <OrderMaterial>();

            if (txtOrderMaterialDate.Text == "" || lvMaterialList.Items.Count < 1)
            {
                lblMessage.Text = "Add All field values correctly";
            }
            else
            {
                foreach (var item in lvMaterialList.Items)
                {
                    var lblMaterialCode = item.FindControl("lblMaterialCode") as Label;
                    var lblQuantity     = item.FindControl("lblQuantity") as Label;
                    var lblUnit         = item.FindControl("lblUnit") as Label;
                    var lblMaterialID   = item.FindControl("lblMaterialID") as Label;

                    OrderMaterial orderMaterial = new OrderMaterial();
                    orderMaterial.MaterialCode      = lblMaterialCode.Text.ToString();
                    orderMaterial.MaterialQuantity  = Convert.ToDouble(lblQuantity.Text);
                    orderMaterial.OrderMaterialDate = Convert.ToDateTime(txtOrderMaterialDate.Text);
                    int OrderID = Convert.ToInt32(ddlOrderNo.SelectedValue);
                    if (OrderID < 1)
                    {
                        orderMaterial.OrderID = Convert.ToInt32(lblorderIDSearch.Text);
                    }
                    else
                    {
                        orderMaterial.OrderID = OrderID;
                    }

                    orderMaterial.OrderNo = ddlOrderNo.SelectedItem.ToString();
                    orderMaterialList.Add(orderMaterial);

                    //OrderMaterialMsg = tailorBLL.SaveOrderMaterial(orderMaterial);
                }
                if (btnSaveOrderMaterial.Text == "Update")
                {
                    OrderMaterialMsg         = tailorBLL.UpdateOrderMaterial(orderMaterialList, lblOrderNoSearch.Text);
                    ddlOrderNo.SelectedIndex = 0;
                }
                else
                {
                    OrderMaterialMsg = tailorBLL.SaveOrderMaterial(orderMaterialList);
                }

                System.Text.StringBuilder strbuilder = new System.Text.StringBuilder();
                strbuilder.Append("<script type = 'text/javascript'>");
                strbuilder.Append("window.onload=function(){");
                strbuilder.Append("alert('");
                strbuilder.Append(OrderMaterialMsg);
                strbuilder.Append("')};");
                strbuilder.Append("</script>");
                ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", strbuilder.ToString());
                ClearAllField();
            }
        }
Beispiel #6
0
        private OrderMaterial setArea1(DataTable dt)
        {
            OrderMaterial dept1 = new OrderMaterial();

            if (dt.Rows.Count > 0)
            {
                dept1.order_material_id = dt.Rows[0][foom.order_material_id].ToString();
                dept1.material_name     = dt.Rows[0][foom.material_name].ToString();
            }

            return(dept1);
        }
Beispiel #7
0
        public OrderMaterial selectByPk1(String copId)
        {
            OrderMaterial cop1 = new OrderMaterial();
            DataTable     dt   = new DataTable();
            String        sql  = "select sex.* " +
                                 "From " + foom.table + " sex " +
                                 //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " +
                                 "Where sex." + foom.pkField + " ='" + copId + "' ";

            dt   = conn.selectData(conn.conn, sql);
            cop1 = setFoodsMaterial(dt);
            return(cop1);
        }
Beispiel #8
0
 /// <summary>
 /// 添加工单物料
 /// </summary>
 private void Add_orderMaterial(DataSet _Order_Material_Data)
 {
     
     Maticsoft.BLL.OrderMaterial _OrM = new OrderMaterial();
     //如果已经添加则不进行添加
     if (!_OrM.Exists("OrderID='" + txb_OrderID.Text + "'"))
     {
         foreach (DataRow dr in _Order_Material_Data.Tables[0].Rows)
         {
             _OrM.Add(dr, txb_OrderID.Text);
         }
     }
      
 }
Beispiel #9
0
        public String insertFoodsMaterial(OrderMaterial p, String userId)
        {
            String re = "";

            if (p.order_material_id.Equals(""))
            {
                re = insert(p, "");
            }
            else
            {
                re = update(p, "");
            }

            return(re);
        }
Beispiel #10
0
        public void getlArea()
        {
            //lDept = new List<Position>();
            lfootp.Clear();
            DataTable dt = new DataTable();

            dt = selectAll();
            foreach (DataRow row in dt.Rows)
            {
                OrderMaterial itm1 = new OrderMaterial();
                itm1.order_material_id = row[foom.order_material_id].ToString();
                itm1.material_name     = row[foom.material_name].ToString();

                lfootp.Add(itm1);
            }
        }
Beispiel #11
0
        public List <OrderMaterial> getlFooSpecByFooId(String fooid)
        {
            //lDept = new List<Position>();
            List <OrderMaterial> lfooC1 = new List <OrderMaterial>();
            DataTable            dt     = new DataTable();

            dt = selectByFoodsId2(fooid);
            foreach (DataRow row in dt.Rows)
            {
                OrderMaterial itm1 = new OrderMaterial();
                itm1.order_material_id = row[foom.order_material_id].ToString();
                itm1.material_name     = row[foom.material_name].ToString();
                itm1.price             = row[foom.price].ToString();
                itm1.weight            = row[foom.weight].ToString();
                lfooC1.Add(itm1);
            }
            return(lfooC1);
        }
Beispiel #12
0
        public String insert(OrderMaterial p, String userId)
        {
            String re  = "";
            String sql = "";

            p.active = "1";
            //p.ssdata_id = "";
            int chk = 0;

            chkNull(p);
            sql = "Insert Into " + foom.table + " set " +
                  " " + foom.weight + " = '" + p.weight + "'" +
                  "," + foom.material_name + " = '" + p.material_name.Replace("'", "''") + "'" +
                  "," + foom.remark + " = '" + p.remark.Replace("'", "''") + "'" +
                  "," + foom.date_create + " = now()" +
                  "," + foom.active + " = '1'" +
                  "," + foom.user_create + " = '" + userId + "' " +
                  "," + foom.host_id + " = '" + p.host_id + "' " +
                  "," + foom.branch_id + " = '" + p.branch_id + "' " +
                  "," + foom.device_id + " = '" + p.device_id + "' " +
                  "," + foom.price + " = '" + p.price + "' " +
                  "," + foom.sort1 + " = '" + p.sort1 + "' " +
                  "," + foom.qty + " = '" + p.qty + "' " +
                  "," + foom.material_id + " = '" + p.material_id + "' " +
                  "," + foom.foods_id + " = '" + p.foods_id + "' " +
                  "," + foom.order_id + " = '" + p.order_id + "' " +
                  "," + foom.foods_name + " = '" + p.foods_name.Replace("'", "''") + "' " +
                  "," + foom.foods_material_id + " = '" + p.foods_material_id + "' " +
                  ";";
            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
Beispiel #13
0
        public String update(OrderMaterial p, String userId)
        {
            String re  = "";
            String sql = "";
            int    chk = 0;

            chkNull(p);
            sql = "Update " + foom.table + " Set " +
                  " " + foom.weight + " = '" + p.weight + "'" +
                  "," + foom.material_name + " = '" + p.material_name.Replace("'", "''") + "'" +
                  "," + foom.remark + " = '" + p.remark.Replace("'", "''") + "'" +
                  "," + foom.date_modi + " = now()" +
                  "," + foom.user_modi + " = '" + userId + "' " +
                  "," + foom.host_id + " = '" + p.host_id + "' " +
                  "," + foom.branch_id + " = '" + p.branch_id + "' " +
                  "," + foom.device_id + " = '" + p.device_id + "' " +
                  "," + foom.price + " = '" + p.price + "' " +
                  "," + foom.foods_id + " = '" + p.foods_id + "' " +
                  "," + foom.qty + " = '" + p.qty + "' " +
                  "," + foom.sort1 + " = '" + p.sort1 + "' " +
                  "," + foom.material_id + " = '" + p.material_id + "' " +
                  "," + foom.order_id + " = '" + p.order_id + "' " +
                  "," + foom.foods_name + " = '" + p.foods_name.Replace("'", "''") + "' " +
                  "," + foom.foods_material_id + " = '" + p.foods_material_id + "' " +
                  "Where " + foom.pkField + "='" + p.order_material_id + "'"
            ;

            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }