Beispiel #1
0
        //保存
        private string getinsertsql(int type)
        {
            StringBuilder            builder = new StringBuilder();
            childSetNutritionguidObj obj1    = new childSetNutritionguidObj();

            if (type == 1)
            {
                obj1.SetAge     = dgvNutrition.CurrentRow.Cells[0].Value.ToString();
                obj1.SetContent = this.txt_shiyingxing.Text.Trim();
            }
            else if (type == 2)
            {
                obj1.SetAge     = dgvNutrition.CurrentRow.Cells[0].Value.ToString();
                obj1.SetContent = this.txt_big.Text.Trim();
            }
            obj1.Type = type;
            builder.Append("insert  into tb_nutritionguid (");
            builder.Append("setAge,");
            builder.Append("shiyongxing,");
            builder.Append("bigdongzuo,");
            builder.Append("type ");
            builder.Append(") values (");
            builder.Append("'" + obj1.SetAge + "',");
            builder.Append("'" + obj1.Shiyongxing + "',");
            builder.Append("'" + obj1.Bigdongzuo + "',");
            builder.Append("'" + obj1.Type + "' )");
            return(builder.ToString());
        }
        public childSetNutritionguidObj getNutritionguidobj(string sqls)
        {
            DateLogic                dg        = new DateLogic();
            SqlDataReader            sdr       = null;
            childSetNutritionguidObj obj       = null;
            ArrayList                arraylist = new ArrayList();;

            try
            {
                sdr = dg.executequery(sqls);
                if (!sdr.HasRows)
                {
                    return(null);
                }
                else
                {
                    obj = new childSetNutritionguidObj();
                    sdr.Read();    //读取第一行数据记录
                    obj.Id = Convert.ToInt32(sdr["id"]);
                    //obj.ChildId = Convert.ToInt32(sdr["childId"]);
                    obj.SetAge = sdr["setAge"].ToString();
                    //obj.SetContent = sdr["setContent"].ToString();
                    obj.Shiyongxing = sdr["shiyongxing"].ToString();
                    obj.Bigdongzuo  = sdr["bigdongzuo"].ToString();
                    //obj.TYPE =Convert.ToInt32(sdr["type"]);
                    return(obj);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("系统异常,请联系管理员", "软件提示");
                throw ex;
            }
        }
        /// <summary>
        /// 查询儿童体检信息  返回集合
        /// </summary>
        /// <param name="sqls"></param>
        /// <returns></returns>
        public ArrayList getNutritionguidList(string sqls)
        {
            DateLogic     dg        = new DateLogic();
            SqlDataReader sdr       = null;
            ArrayList     arraylist = new ArrayList();;

            try
            {
                sdr = dg.executequery(sqls);
                if (!sdr.HasRows)
                {
                    return(null);
                }
                else
                {
                    while (sdr.Read())
                    {
                        //sdr.Read();//读取第一行数据记录
                        childSetNutritionguidObj obj = new childSetNutritionguidObj();
                        obj.Id = Convert.ToInt32(sdr["id"]);
                        //obj.ChildId = Convert.ToInt32(sdr["childId"]);
                        obj.SetAge = sdr["setAge"].ToString();
                        arraylist.Add(obj);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("系统异常,请联系管理员", "软件提示");
                throw ex;
            }
            return(arraylist);
        }
Beispiel #4
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private string getupdatesql()
        {
            StringBuilder            builder = new StringBuilder();
            childSetNutritionguidObj obj1    = new childSetNutritionguidObj();

            obj1.SetAge      = dgvNutrition.CurrentRow.Cells[0].Value.ToString();
            obj1.Shiyongxing = this.txt_shiyingxing.Text.Trim();
            obj1.Bigdongzuo  = this.txt_big.Text.Trim();

            builder.Append("update tb_nutritionguid set ");
            builder.Append("setAge='" + obj1.SetAge + "',");
            builder.Append("shiyongxing='" + obj1.Shiyongxing + "',");
            builder.Append("bigdongzuo='" + obj1.Bigdongzuo + "' ");
            builder.Append(" where id = " + id + "");
            return(builder.ToString());
        }
Beispiel #5
0
        /// <summary>
        /// 根据每行的Id 加载对应的设置内容
        /// </summary>
        /// <param name="rowIndex"></param>
        /// <param name="type">类型</param>
        private void addContent(int rowIndex)
        {
            string sqls = string.Format("select * from tb_nutritionguid where id = " + rowIndex + "");

            obj = bll.getNutritionguidobj(sqls);
            if (obj != null)
            {
                this.txt_shiyingxing.Text = obj.Shiyongxing;
                this.txt_big.Text         = obj.Bigdongzuo;
                id = obj.Id;
            }
            else
            {
                this.txt_shiyingxing.Text = "";
                this.txt_big.Text         = "";
            }
        }