Exemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.W_Receiver model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into W_Receiver(");
            strSql.Append("Receiver)");
            strSql.Append(" values (");
            strSql.Append("@Receiver)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Receiver", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.Receiver;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.W_Receiver GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,Receiver from W_Receiver ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            Maticsoft.Model.W_Receiver model = new Maticsoft.Model.W_Receiver();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                model.Receiver = ds.Tables[0].Rows[0]["Receiver"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Maticsoft.Model.W_Receiver model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update W_Receiver set ");
            strSql.Append("Receiver=@Receiver");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",       SqlDbType.Int,      4),
                new SqlParameter("@Receiver", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.Receiver;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemplo n.º 4
0
        protected void Bind(int Id)
        {
            Maticsoft.BLL.W_Material bll = new Maticsoft.BLL.W_Material();
            Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
            model = bll.GetModel(Id);
            this.lblId.Text = model.Id.ToString();
            this.lblName.Text = model.Name;
            this.lblBeginDate.Text = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
            this.lblEnddate.Text = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
            this.Label_Address.Text = model.Address;
            this.Label_Number.Text = model.Number;


            DataSet ds2 = new DataSet();
            Maticsoft.BLL.W_Receivestate bll3 = new Maticsoft.BLL.W_Receivestate();
            ds2 = bll3.GetList("MaterialId=" + Id);
            for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
            {
                int j = int.Parse(ds2.Tables[0].Rows[i][2].ToString());
                Maticsoft.BLL.W_Receiver bll4 = new Maticsoft.BLL.W_Receiver();
                Maticsoft.Model.W_Receiver model4 = new Maticsoft.Model.W_Receiver();
                model4 = bll4.GetModel(j);
                this.lblReceiver.Text += model4.Receiver + "  ";

            }

            DataSet ds5 = new DataSet();
            Maticsoft.BLL.W_Receivestate bll5 = new Maticsoft.BLL.W_Receivestate();
            ds5 = bll5.GetList("MaterialId=" + Id + "and Dormacy = '提交'");
            for (int i = 0; i < ds5.Tables[0].Rows.Count; i++)
            {
                int j = int.Parse(ds5.Tables[0].Rows[i][2].ToString());
                Maticsoft.BLL.W_Receiver bll4 = new Maticsoft.BLL.W_Receiver();
                Maticsoft.Model.W_Receiver model4 = new Maticsoft.Model.W_Receiver();
                model4 = bll4.GetModel(j);
                this.Label_IsHanded.Text += model4.Receiver + "  ";

            }

        }
Exemplo n.º 5
0
        protected void Bind(int Id)
        {
            Maticsoft.BLL.W_Material   bll   = new Maticsoft.BLL.W_Material();
            Maticsoft.Model.W_Material model = new Maticsoft.Model.W_Material();
            model                   = bll.GetModel(Id);
            this.lblId.Text         = model.Id.ToString();
            this.lblName.Text       = model.Name;
            this.lblBeginDate.Text  = (Convert.ToDateTime(model.Begindate)).ToShortDateString();
            this.lblEnddate.Text    = (Convert.ToDateTime(model.Enddate)).ToShortDateString();
            this.Label_Address.Text = model.Address;
            this.Label_Number.Text  = model.Number;


            DataSet ds2 = new DataSet();

            Maticsoft.BLL.W_Receivestate bll3 = new Maticsoft.BLL.W_Receivestate();
            ds2 = bll3.GetList("MaterialId=" + Id);
            for (int i = 0; i < ds2.Tables[0].Rows.Count; i++)
            {
                int j = int.Parse(ds2.Tables[0].Rows[i][2].ToString());
                Maticsoft.BLL.W_Receiver   bll4   = new Maticsoft.BLL.W_Receiver();
                Maticsoft.Model.W_Receiver model4 = new Maticsoft.Model.W_Receiver();
                model4 = bll4.GetModel(j);
                this.lblReceiver.Text += model4.Receiver + "  ";
            }

            DataSet ds5 = new DataSet();

            Maticsoft.BLL.W_Receivestate bll5 = new Maticsoft.BLL.W_Receivestate();
            ds5 = bll5.GetList("MaterialId=" + Id + "and Dormacy = '提交'");
            for (int i = 0; i < ds5.Tables[0].Rows.Count; i++)
            {
                int j = int.Parse(ds5.Tables[0].Rows[i][2].ToString());
                Maticsoft.BLL.W_Receiver   bll4   = new Maticsoft.BLL.W_Receiver();
                Maticsoft.Model.W_Receiver model4 = new Maticsoft.Model.W_Receiver();
                model4 = bll4.GetModel(j);
                this.Label_IsHanded.Text += model4.Receiver + "  ";
            }
        }
Exemplo n.º 6
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Maticsoft.Model.W_Receiver GetModel(int Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 Id,Receiver from W_Receiver ");
			strSql.Append(" where Id=@Id ");
			SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.Int,4)};
			parameters[0].Value = Id;

			Maticsoft.Model.W_Receiver model=new Maticsoft.Model.W_Receiver();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				if(ds.Tables[0].Rows[0]["Id"].ToString()!="")
				{
					model.Id=int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
				}
				model.Receiver=ds.Tables[0].Rows[0]["Receiver"].ToString();
				return model;
			}
			else
			{
				return null;
			}
		}