Example #1
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public bool Add(CustomerService.Model.Service model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@GUID",          SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@sNO",           SqlDbType.VarChar,           50),
                new SqlParameter("@customer",      SqlDbType.UniqueIdentifier,  16),
                new SqlParameter("@acceptDate",    SqlDbType.DateTime),
                new SqlParameter("@solutionDate",  SqlDbType.DateTime),
                new SqlParameter("@type",          SqlDbType.VarChar,           20),
                new SqlParameter("@content",       SqlDbType.VarChar,          500),
                new SqlParameter("@result",        SqlDbType.VarChar,          100),
                new SqlParameter("@evaluate",      SqlDbType.VarChar,           50),
                new SqlParameter("@material",      SqlDbType.VarChar,           50),
                new SqlParameter("@materialMoney", SqlDbType.Money,              8),
                new SqlParameter("@serviceMoney",  SqlDbType.Money,              8),
                new SqlParameter("@payStatus",     SqlDbType.VarChar,           50),
                new SqlParameter("@traffic",       SqlDbType.VarChar,           50),
                new SqlParameter("@employee",      SqlDbType.VarChar,           20),
                new SqlParameter("@createDate",    SqlDbType.DateTime)
            };
            parameters[0].Value  = Guid.NewGuid();
            parameters[1].Value  = model.sNO;
            parameters[2].Value  = model.customer;
            parameters[3].Value  = model.acceptDate;
            parameters[4].Value  = model.solutionDate;
            parameters[5].Value  = model.type;
            parameters[6].Value  = model.content;
            parameters[7].Value  = model.result;
            parameters[8].Value  = model.evaluate;
            parameters[9].Value  = model.material;
            parameters[10].Value = model.materialMoney;
            parameters[11].Value = model.serviceMoney;
            parameters[12].Value = model.payStatus;
            parameters[13].Value = model.traffic;
            parameters[14].Value = model.employee;
            parameters[15].Value = DateTime.Now;

            DbHelperSQL.RunProcedure("T_Service_ADD", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public CustomerService.Model.Service GetModel(Guid GUID)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@GUID", SqlDbType.UniqueIdentifier,16)};
			parameters[0].Value = GUID;

			CustomerService.Model.Service model=new CustomerService.Model.Service();
			DataSet ds= DbHelperSQL.RunProcedure("T_Service_GetModel",parameters,"ds");
			if(ds.Tables[0].Rows.Count>0)
			{
				if(ds.Tables[0].Rows[0]["GUID"]!=null && ds.Tables[0].Rows[0]["GUID"].ToString()!="")
				{
					model.GUID=new Guid(ds.Tables[0].Rows[0]["GUID"].ToString());
				}
				if(ds.Tables[0].Rows[0]["sNO"]!=null && ds.Tables[0].Rows[0]["sNO"].ToString()!="")
				{
					model.sNO=ds.Tables[0].Rows[0]["sNO"].ToString();
				}
				if(ds.Tables[0].Rows[0]["customer"]!=null && ds.Tables[0].Rows[0]["customer"].ToString()!="")
				{
					model.customer=new Guid(ds.Tables[0].Rows[0]["customer"].ToString());
				}
				if(ds.Tables[0].Rows[0]["acceptDate"]!=null && ds.Tables[0].Rows[0]["acceptDate"].ToString()!="")
				{
					model.acceptDate=DateTime.Parse(ds.Tables[0].Rows[0]["acceptDate"].ToString());
				}
				if(ds.Tables[0].Rows[0]["solutionDate"]!=null && ds.Tables[0].Rows[0]["solutionDate"].ToString()!="")
				{
					model.solutionDate=DateTime.Parse(ds.Tables[0].Rows[0]["solutionDate"].ToString());
				}
				if(ds.Tables[0].Rows[0]["type"]!=null && ds.Tables[0].Rows[0]["type"].ToString()!="")
				{
					model.type=ds.Tables[0].Rows[0]["type"].ToString();
				}
				if(ds.Tables[0].Rows[0]["content"]!=null && ds.Tables[0].Rows[0]["content"].ToString()!="")
				{
					model.content=ds.Tables[0].Rows[0]["content"].ToString();
				}
				if(ds.Tables[0].Rows[0]["result"]!=null && ds.Tables[0].Rows[0]["result"].ToString()!="")
				{
					model.result=ds.Tables[0].Rows[0]["result"].ToString();
				}
				if(ds.Tables[0].Rows[0]["evaluate"]!=null && ds.Tables[0].Rows[0]["evaluate"].ToString()!="")
				{
					model.evaluate=ds.Tables[0].Rows[0]["evaluate"].ToString();
				}
				if(ds.Tables[0].Rows[0]["material"]!=null && ds.Tables[0].Rows[0]["material"].ToString()!="")
				{
					model.material=ds.Tables[0].Rows[0]["material"].ToString();
				}
				if(ds.Tables[0].Rows[0]["materialMoney"]!=null && ds.Tables[0].Rows[0]["materialMoney"].ToString()!="")
				{
					model.materialMoney=decimal.Parse(ds.Tables[0].Rows[0]["materialMoney"].ToString());
				}
				if(ds.Tables[0].Rows[0]["serviceMoney"]!=null && ds.Tables[0].Rows[0]["serviceMoney"].ToString()!="")
				{
					model.serviceMoney=decimal.Parse(ds.Tables[0].Rows[0]["serviceMoney"].ToString());
				}
				if(ds.Tables[0].Rows[0]["payStatus"]!=null && ds.Tables[0].Rows[0]["payStatus"].ToString()!="")
				{
					model.payStatus=ds.Tables[0].Rows[0]["payStatus"].ToString();
				}
				if(ds.Tables[0].Rows[0]["traffic"]!=null && ds.Tables[0].Rows[0]["traffic"].ToString()!="")
				{
					model.traffic=ds.Tables[0].Rows[0]["traffic"].ToString();
				}
				if(ds.Tables[0].Rows[0]["employee"]!=null && ds.Tables[0].Rows[0]["employee"].ToString()!="")
				{
					model.employee=ds.Tables[0].Rows[0]["employee"].ToString();
				}
				if(ds.Tables[0].Rows[0]["createDate"]!=null && ds.Tables[0].Rows[0]["createDate"].ToString()!="")
				{
					model.createDate=DateTime.Parse(ds.Tables[0].Rows[0]["createDate"].ToString());
				}
				return model;
			}
			else
			{
				return null;
			}
		}
Example #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CustomerService.Model.Service GetModel(Guid GUID)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@GUID", SqlDbType.UniqueIdentifier, 16)
            };
            parameters[0].Value = GUID;

            CustomerService.Model.Service model = new CustomerService.Model.Service();
            DataSet ds = DbHelperSQL.RunProcedure("T_Service_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["GUID"] != null && ds.Tables[0].Rows[0]["GUID"].ToString() != "")
                {
                    model.GUID = new Guid(ds.Tables[0].Rows[0]["GUID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["sNO"] != null && ds.Tables[0].Rows[0]["sNO"].ToString() != "")
                {
                    model.sNO = ds.Tables[0].Rows[0]["sNO"].ToString();
                }
                if (ds.Tables[0].Rows[0]["customer"] != null && ds.Tables[0].Rows[0]["customer"].ToString() != "")
                {
                    model.customer = new Guid(ds.Tables[0].Rows[0]["customer"].ToString());
                }
                if (ds.Tables[0].Rows[0]["acceptDate"] != null && ds.Tables[0].Rows[0]["acceptDate"].ToString() != "")
                {
                    model.acceptDate = DateTime.Parse(ds.Tables[0].Rows[0]["acceptDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["solutionDate"] != null && ds.Tables[0].Rows[0]["solutionDate"].ToString() != "")
                {
                    model.solutionDate = DateTime.Parse(ds.Tables[0].Rows[0]["solutionDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["type"] != null && ds.Tables[0].Rows[0]["type"].ToString() != "")
                {
                    model.type = ds.Tables[0].Rows[0]["type"].ToString();
                }
                if (ds.Tables[0].Rows[0]["content"] != null && ds.Tables[0].Rows[0]["content"].ToString() != "")
                {
                    model.content = ds.Tables[0].Rows[0]["content"].ToString();
                }
                if (ds.Tables[0].Rows[0]["result"] != null && ds.Tables[0].Rows[0]["result"].ToString() != "")
                {
                    model.result = ds.Tables[0].Rows[0]["result"].ToString();
                }
                if (ds.Tables[0].Rows[0]["evaluate"] != null && ds.Tables[0].Rows[0]["evaluate"].ToString() != "")
                {
                    model.evaluate = ds.Tables[0].Rows[0]["evaluate"].ToString();
                }
                if (ds.Tables[0].Rows[0]["material"] != null && ds.Tables[0].Rows[0]["material"].ToString() != "")
                {
                    model.material = ds.Tables[0].Rows[0]["material"].ToString();
                }
                if (ds.Tables[0].Rows[0]["materialMoney"] != null && ds.Tables[0].Rows[0]["materialMoney"].ToString() != "")
                {
                    model.materialMoney = decimal.Parse(ds.Tables[0].Rows[0]["materialMoney"].ToString());
                }
                if (ds.Tables[0].Rows[0]["serviceMoney"] != null && ds.Tables[0].Rows[0]["serviceMoney"].ToString() != "")
                {
                    model.serviceMoney = decimal.Parse(ds.Tables[0].Rows[0]["serviceMoney"].ToString());
                }
                if (ds.Tables[0].Rows[0]["payStatus"] != null && ds.Tables[0].Rows[0]["payStatus"].ToString() != "")
                {
                    model.payStatus = ds.Tables[0].Rows[0]["payStatus"].ToString();
                }
                if (ds.Tables[0].Rows[0]["traffic"] != null && ds.Tables[0].Rows[0]["traffic"].ToString() != "")
                {
                    model.traffic = ds.Tables[0].Rows[0]["traffic"].ToString();
                }
                if (ds.Tables[0].Rows[0]["employee"] != null && ds.Tables[0].Rows[0]["employee"].ToString() != "")
                {
                    model.employee = ds.Tables[0].Rows[0]["employee"].ToString();
                }
                if (ds.Tables[0].Rows[0]["createDate"] != null && ds.Tables[0].Rows[0]["createDate"].ToString() != "")
                {
                    model.createDate = DateTime.Parse(ds.Tables[0].Rows[0]["createDate"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }