Example #1
0
        public String update(FoodsMaterial 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 + "' " +
                  "Where " + foom.pkField + "='" + p.foods_material_id + "'"
            ;

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

            return(re);
        }
Example #2
0
        private void initConfig()
        {
            lfootp = new List <FoodsMaterial>();
            foom   = new FoodsMaterial();
            foom.foods_material_id = "foods_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.material_id = "material_id";

            foom.pkField = "foods_material_id";
            foom.table   = "b_foods_material";
        }
Example #3
0
        private void chkNull(FoodsMaterial 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.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";
        }
Example #4
0
        private FoodsMaterial setArea1(DataTable dt)
        {
            FoodsMaterial dept1 = new FoodsMaterial();

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

            return(dept1);
        }
Example #5
0
        public FoodsMaterial selectByPk1(String copId)
        {
            FoodsMaterial cop1 = new FoodsMaterial();
            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);
        }
Example #6
0
        private FoodsMaterial setFoodsMaterial(DataTable dt)
        {
            FoodsMaterial dept1 = new FoodsMaterial();

            if (dt.Rows.Count > 0)
            {
                dept1.foods_material_id = dt.Rows[0][foom.foods_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() : "";
            }
            else
            {
                dept1.foods_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 = "";
            }

            return(dept1);
        }
Example #7
0
        public String insertFoodsMaterial(FoodsMaterial p, String userId)
        {
            String re = "";

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

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

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

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

            dt = selectByFoodsId2(fooid);
            foreach (DataRow row in dt.Rows)
            {
                FoodsMaterial itm1 = new FoodsMaterial();
                itm1.foods_material_id = row[foom.foods_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);
        }
Example #10
0
        private void saveFoodsMaterial()
        {
            //throw new NotImplementedException();
            if (grfMat.Row <= 0)
            {
                return;
            }
            if (grfMat.Col <= 1)
            {
                return;
            }

            String foomid = "", foomname = "", foomprice = "", foomqty = "", foomweight = "", matid = "";

            matid      = grfMat[grfMat.Row, colFmId] != null ? grfMat[grfMat.Row, colFmId].ToString() : "";
            foomname   = grfMat[grfMat.Row, colFmName] != null ? grfMat[grfMat.Row, colFmName].ToString() : "";
            foomprice  = grfMat[grfMat.Row, colFmprice] != null ? grfMat[grfMat.Row, colFmprice].ToString() : "";
            foomweight = grfMat[grfMat.Row, colFmWeight] != null ? grfMat[grfMat.Row, colFmWeight].ToString() : "";
            //foomid = grfMat[grfMat.Row, 1] != null ? grfMat[grfMat.Row, 1].ToString() : "";

            FoodsMaterial foom = new FoodsMaterial();

            foom.foods_material_id = "";
            foom.foods_id          = txtID.Text;
            foom.material_id       = matid.Trim();
            foom.material_name     = foomname;
            foom.active            = "1";
            foom.remark            = "";
            foom.sort1             = "";
            foom.date_cancel       = "";
            foom.date_create       = "";
            foom.date_modi         = "";
            foom.user_cancel       = "";
            foom.user_create       = "";
            foom.user_modi         = "";
            foom.host_id           = "";
            foom.branch_id         = "";
            foom.device_id         = mposC.MACAddress;
            foom.price             = foomprice;
            foom.qty    = "1";
            foom.weight = foomweight;
            mposC.mposDB.foomDB.insertFoodsMaterial(foom, "");
            setGrfFoodsMaterial(txtID.Text);
        }
Example #11
0
        public String insert(FoodsMaterial 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 + "' " +
                  " ";
            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }