示例#1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            int id = int.Parse(context.Request.Form["id"]);

            Dal.Tools_DefinationDAL tools_DefinationDAL = new Dal.Tools_DefinationDAL();
            Model.Tools_Defination  tools_Defination    = tools_DefinationDAL.GetModel(id);
            if (tools_Defination.UPL == 0)
            {
                context.Response.Write("no");
            }
            else
            {
                tools_Defination.UPL = tools_Defination.UPL - 1;
                if (tools_DefinationDAL.Update(tools_Defination))
                {
                    context.Response.Write("ok");
                }
                else
                {
                    context.Response.Write("no");
                }
            }
        }
示例#2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int id = int.Parse(context.Request.Form["id"]);

            Dal.Tools_DefinationDAL tools_DefinationDAL             = new Dal.Tools_DefinationDAL();
            Model.Tools_Defination  tools_Defination                = tools_DefinationDAL.GetModel(id);
            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string str = js.Serialize(tools_Defination);

            context.Response.Write(str);
        }
示例#3
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public Model.Tools_Defination ReaderBind(IDataReader dataReader)
        {
            Model.Tools_Defination model = new Model.Tools_Defination();
            object ojb;

            ojb = dataReader["ID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ID = int.Parse(ojb.ToString());
            }
            model.WorkceIIID = dataReader["WorkceIIID"].ToString();
            model.WorkceII   = dataReader["WorkceII"].ToString();
            model.FamilyID   = dataReader["FamilyID"].ToString();
            model.Family     = dataReader["Family"].ToString();
            model.Code       = dataReader["Code"].ToString();
            model.Name       = dataReader["Name"].ToString();
            model.Model      = dataReader["Model"].ToString();
            model.PartNo     = dataReader["PartNo"].ToString();
            model.UsedFor    = dataReader["UsedFor"].ToString();
            ojb = dataReader["UPL"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UPL = int.Parse(ojb.ToString());
            }
            model.Owner      = dataReader["Owner"].ToString();
            model.OwnerNamer = dataReader["OwnerNamer"].ToString();
            model.Remark     = dataReader["Remark"].ToString();
            model.PMperiord  = dataReader["PMperiord"].ToString();
            ojb = dataReader["RecOn"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RecOn = DateTime.Parse(ojb.ToString());
            }
            model.RecBy     = dataReader["RecBy"].ToString();
            model.RecByName = dataReader["RecByName"].ToString();
            ojb             = dataReader["EditOn"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EditOn = DateTime.Parse(ojb.ToString());
            }
            model.EditBy     = dataReader["EditBy"].ToString();
            model.EditByName = dataReader["EditByName"].ToString();
            return(model);
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Tools_Defination GetModel(string code)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from [Tools_Defination] ");
            strSql.Append(" where Code=@ID ");
            MSSQLHelper h = new MSSQLHelper();

            h.CreateCommand(strSql.ToString());
            h.AddParameter("@ID", code);
            Model.Tools_Defination model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                h.CloseConn();
            }
            return(model);
        }
示例#5
0
        /// <summary>
        /// 根据条件得到一个对象实体
        /// </summary>
        public Model.Tools_Defination GetModelByCond(string cond)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 * from [Tools_Defination] ");
            if (!string.IsNullOrEmpty(cond))
            {
                strSql.Append(" where " + cond);
            }
            MSSQLHelper h = new MSSQLHelper();

            h.CreateCommand(strSql.ToString());
            Model.Tools_Defination model = null;
            using (IDataReader dataReader = h.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                h.CloseConn();
            }
            return(model);
        }
示例#6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            Model.Tools_Defination tools_Defination = new Model.Tools_Defination();
            tools_Defination.Name   = context.Request["name"];
            tools_Defination.Code   = context.Request["code"];
            tools_Defination.RecBy  = context.Request["recby"];
            tools_Defination.RecOn  = DateTime.Now;
            tools_Defination.PartNo = context.Request["partno"];
            tools_Defination.Model  = context.Request["model"];
            tools_Defination.Family = context.Request["family"];
            tools_Defination.RecOn  = DateTime.Now;
            Dal.Tools_DefinationDAL tools = new Dal.Tools_DefinationDAL();
            if (tools.Add(tools_Defination) > 0)
            {
                context.Response.Write("ok");
            }
            else
            {
                context.Response.Write("no");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string code = context.Request["code"];

            Dal.Tools_DefinationDAL tools            = new Dal.Tools_DefinationDAL();
            Model.Tools_Defination  tools_Defination = tools.GetModel(code);
            tools_Defination.Name   = context.Request["name"];
            tools_Defination.Code   = context.Request["code"];
            tools_Defination.PartNo = context.Request["partno"];
            tools_Defination.Model  = context.Request["model"];
            tools_Defination.Family = context.Request["family"];
            tools_Defination.EditOn = DateTime.Now;

            if (tools.Update(tools_Defination))
            {
                context.Response.Write("ok");
            }
            else
            {
                context.Response.Write("no");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int id = int.Parse(context.Request["id"]);

            Dal.Tools_DefinationDAL tools            = new Dal.Tools_DefinationDAL();
            Model.Tools_Defination  tools_Defination = tools.GetModel(id);
            tools_Defination.Name      = context.Request["name"];
            tools_Defination.UsedFor   = context.Request["usedfor"];
            tools_Defination.WorkceII  = context.Request["workcell"];
            tools_Defination.PMperiord = context.Request["periord"];
            tools_Defination.RecBy     = context.Request["recon"];
            tools_Defination.EditBy    = context.Request["editby"];
            tools_Defination.EditOn    = DateTime.Now;

            if (tools.Update(tools_Defination))
            {
                context.Response.Write("ok");
            }
            else
            {
                context.Response.Write("no");
            }
        }
示例#9
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.Tools_Defination model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [Tools_Defination](");
            strSql.Append("[WorkceIIID], [WorkceII], [FamilyID], [Family], [Code], [Name], [Model], [PartNo], [UsedFor], [UPL], [Owner], [OwnerNamer], [Remark], [PMperiord], [RecOn], [RecBy], [RecByName], [EditOn], [EditBy], [EditByName] )");
            strSql.Append(" values (");
            strSql.Append("@WorkceIIID, @WorkceII, @FamilyID, @Family, @Code, @Name, @Model, @PartNo, @UsedFor, @UPL, @Owner, @OwnerNamer, @Remark, @PMperiord, @RecOn, @RecBy, @RecByName, @EditOn, @EditBy, @EditByName )");
            strSql.Append(";select @@IDENTITY");
            MSSQLHelper h = new MSSQLHelper();

            h.CreateCommand(strSql.ToString());
            if (model.WorkceIIID == null)
            {
                h.AddParameter("@WorkceIIID", DBNull.Value);
            }
            else
            {
                h.AddParameter("@WorkceIIID", model.WorkceIIID);
            }
            if (model.WorkceII == null)
            {
                h.AddParameter("@WorkceII", DBNull.Value);
            }
            else
            {
                h.AddParameter("@WorkceII", model.WorkceII);
            }
            if (model.FamilyID == null)
            {
                h.AddParameter("@FamilyID", DBNull.Value);
            }
            else
            {
                h.AddParameter("@FamilyID", model.FamilyID);
            }
            if (model.Family == null)
            {
                h.AddParameter("@Family", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Family", model.Family);
            }
            if (model.Code == null)
            {
                h.AddParameter("@Code", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Code", model.Code);
            }
            if (model.Name == null)
            {
                h.AddParameter("@Name", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Name", model.Name);
            }
            if (model.Model == null)
            {
                h.AddParameter("@Model", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Model", model.Model);
            }
            if (model.PartNo == null)
            {
                h.AddParameter("@PartNo", DBNull.Value);
            }
            else
            {
                h.AddParameter("@PartNo", model.PartNo);
            }
            if (model.UsedFor == null)
            {
                h.AddParameter("@UsedFor", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UsedFor", model.UsedFor);
            }
            if (model.UPL == null)
            {
                h.AddParameter("@UPL", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UPL", model.UPL);
            }
            if (model.Owner == null)
            {
                h.AddParameter("@Owner", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Owner", model.Owner);
            }
            if (model.OwnerNamer == null)
            {
                h.AddParameter("@OwnerNamer", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OwnerNamer", model.OwnerNamer);
            }
            if (model.Remark == null)
            {
                h.AddParameter("@Remark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Remark", model.Remark);
            }
            if (model.PMperiord == null)
            {
                h.AddParameter("@PMperiord", DBNull.Value);
            }
            else
            {
                h.AddParameter("@PMperiord", model.PMperiord);
            }
            if (model.RecOn == null)
            {
                h.AddParameter("@RecOn", DateTime.Now);
            }
            else
            {
                h.AddParameter("@RecOn", model.RecOn);
            }
            if (model.RecBy == null)
            {
                h.AddParameter("@RecBy", DBNull.Value);
            }
            else
            {
                h.AddParameter("@RecBy", model.RecBy);
            }
            if (model.RecByName == null)
            {
                h.AddParameter("@RecByName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@RecByName", model.RecByName);
            }
            if (model.EditOn == null)
            {
                h.AddParameter("@EditOn", DateTime.Now);
            }
            else
            {
                h.AddParameter("@EditOn", model.EditOn);
            }
            if (model.EditBy == null)
            {
                h.AddParameter("@EditBy", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditBy", model.EditBy);
            }
            if (model.EditByName == null)
            {
                h.AddParameter("@EditByName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditByName", model.EditByName);
            }
            int    result;
            string obj = h.ExecuteScalar();

            if (!int.TryParse(obj, out result))
            {
                return(0);
            }
            return(result);
        }
示例#10
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Tools_Defination model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [Tools_Defination] set ");
            strSql.Append("[WorkceIIID]=@WorkceIIID, [WorkceII]=@WorkceII, [FamilyID]=@FamilyID, [Family]=@Family, [Code]=@Code, [Name]=@Name, [Model]=@Model, [PartNo]=@PartNo, [UsedFor]=@UsedFor, [UPL]=@UPL, [Owner]=@Owner, [OwnerNamer]=@OwnerNamer, [Remark]=@Remark, [PMperiord]=@PMperiord, [RecOn]=@RecOn, [RecBy]=@RecBy, [RecByName]=@RecByName, [EditOn]=@EditOn, [EditBy]=@EditBy, [EditByName]=@EditByName   ");
            strSql.Append(" where ID=@ID ");
            MSSQLHelper h = new MSSQLHelper();

            h.CreateCommand(strSql.ToString());
            if (model.ID.ToString() == null)
            {
                h.AddParameter("@ID", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ID", model.ID);
            }
            if (model.WorkceIIID == null)
            {
                h.AddParameter("@WorkceIIID", DBNull.Value);
            }
            else
            {
                h.AddParameter("@WorkceIIID", model.WorkceIIID);
            }
            if (model.WorkceII == null)
            {
                h.AddParameter("@WorkceII", DBNull.Value);
            }
            else
            {
                h.AddParameter("@WorkceII", model.WorkceII);
            }
            if (model.FamilyID == null)
            {
                h.AddParameter("@FamilyID", DBNull.Value);
            }
            else
            {
                h.AddParameter("@FamilyID", model.FamilyID);
            }
            if (model.Family == null)
            {
                h.AddParameter("@Family", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Family", model.Family);
            }
            if (model.Code == null)
            {
                h.AddParameter("@Code", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Code", model.Code);
            }
            if (model.Name == null)
            {
                h.AddParameter("@Name", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Name", model.Name);
            }
            if (model.Model == null)
            {
                h.AddParameter("@Model", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Model", model.Model);
            }
            if (model.PartNo == null)
            {
                h.AddParameter("@PartNo", DBNull.Value);
            }
            else
            {
                h.AddParameter("@PartNo", model.PartNo);
            }
            if (model.UsedFor == null)
            {
                h.AddParameter("@UsedFor", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UsedFor", model.UsedFor);
            }
            if (model.UPL == null)
            {
                h.AddParameter("@UPL", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UPL", model.UPL);
            }
            if (model.Owner == null)
            {
                h.AddParameter("@Owner", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Owner", model.Owner);
            }
            if (model.OwnerNamer == null)
            {
                h.AddParameter("@OwnerNamer", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OwnerNamer", model.OwnerNamer);
            }
            if (model.Remark == null)
            {
                h.AddParameter("@Remark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Remark", model.Remark);
            }
            if (model.PMperiord == null)
            {
                h.AddParameter("@PMperiord", DBNull.Value);
            }
            else
            {
                h.AddParameter("@PMperiord", model.PMperiord);
            }
            if (model.RecOn == null)
            {
                h.AddParameter("@RecOn", DBNull.Value);
            }
            else
            {
                h.AddParameter("@RecOn", model.RecOn);
            }
            if (model.RecBy == null)
            {
                h.AddParameter("@RecBy", DBNull.Value);
            }
            else
            {
                h.AddParameter("@RecBy", model.RecBy);
            }
            if (model.RecByName == null)
            {
                h.AddParameter("@RecByName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@RecByName", model.RecByName);
            }
            if (model.EditOn == null)
            {
                h.AddParameter("@EditOn", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditOn", model.EditOn);
            }
            if (model.EditBy == null)
            {
                h.AddParameter("@EditBy", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditBy", model.EditBy);
            }
            if (model.EditByName == null)
            {
                h.AddParameter("@EditByName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@EditByName", model.EditByName);
            }
            return(h.ExecuteNonQuery());
        }