Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Users model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [Users] set ");
            strSql.Append("[UserName]=@UserName, [UserPwd]=@UserPwd, [Phone]=@Phone, [Mail]=@Mail, [Permission]=@Permission   ");
            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.UserName == null)
            {
                h.AddParameter("@UserName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UserName", model.UserName);
            }
            if (model.UserPwd == null)
            {
                h.AddParameter("@UserPwd", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UserPwd", model.UserPwd);
            }
            if (model.Phone == null)
            {
                h.AddParameter("@Phone", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Phone", model.Phone);
            }
            if (model.Mail == null)
            {
                h.AddParameter("@Mail", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Mail", model.Mail);
            }
            if (model.Permission == null)
            {
                h.AddParameter("@Permission", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Permission", model.Permission);
            }
            return(h.ExecuteNonQuery());
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.Users model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [Users](");
            strSql.Append("[UserName], [UserPwd], [Phone], [Mail], [Permission] )");
            strSql.Append(" values (");
            strSql.Append("@UserName, @UserPwd, @Phone, @Mail, @Permission )");
            strSql.Append(";select @@IDENTITY");
            MSSQLHelper h = new MSSQLHelper();

            h.CreateCommand(strSql.ToString());
            if (model.UserName == null)
            {
                h.AddParameter("@UserName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UserName", model.UserName);
            }
            if (model.UserPwd == null)
            {
                h.AddParameter("@UserPwd", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UserPwd", model.UserPwd);
            }
            if (model.Phone == null)
            {
                h.AddParameter("@Phone", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Phone", model.Phone);
            }
            if (model.Mail == null)
            {
                h.AddParameter("@Mail", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Mail", model.Mail);
            }
            if (model.Permission == null)
            {
                h.AddParameter("@Permission", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Permission", model.Permission);
            }
            int    result;
            string obj = h.ExecuteScalar();

            if (!int.TryParse(obj, out result))
            {
                return(0);
            }
            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Tools_entitys model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [Tools_entitys] set ");
            strSql.Append("[Code]=@Code, [SeqID]=@SeqID, [BillNo]=@BillNo, [RegDate]=@RegDate, [UserCount]=@UserCount, [Location]=@Location   ");
            strSql.Append(" where ID=@ID ");
            MSSQLHelper h = new MSSQLHelper();

            h.CreateCommand(strSql.ToString());
            if (model.Code == null)
            {
                h.AddParameter("@Code", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Code", model.Code);
            }
            if (model.SeqID == null)
            {
                h.AddParameter("@SeqID", DBNull.Value);
            }
            else
            {
                h.AddParameter("@SeqID", model.SeqID);
            }
            if (model.BillNo == null)
            {
                h.AddParameter("@BillNo", DBNull.Value);
            }
            else
            {
                h.AddParameter("@BillNo", model.BillNo);
            }
            if (model.RegDate == null)
            {
                h.AddParameter("@RegDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@RegDate", model.RegDate);
            }
            if (model.UserCount == null)
            {
                h.AddParameter("@UserCount", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UserCount", model.UserCount);
            }
            if (model.Location == null)
            {
                h.AddParameter("@Location", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Location", model.Location);
            }
            return(h.ExecuteNonQuery());
        }
Esempio n. 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.Tools_entitys model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [Tools_entitys](");
            strSql.Append("[Code], [SeqID], [BillNo], [RegDate], [UserCount], [Location] )");
            strSql.Append(" values (");
            strSql.Append("@Code, @SeqID, @BillNo, @RegDate, @UserCount, @Location )");
            strSql.Append(";select @@IDENTITY");
            MSSQLHelper h = new MSSQLHelper();

            h.CreateCommand(strSql.ToString());
            if (model.Code == null)
            {
                h.AddParameter("@Code", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Code", model.Code);
            }
            if (model.SeqID == null)
            {
                h.AddParameter("@SeqID", DBNull.Value);
            }
            else
            {
                h.AddParameter("@SeqID", model.SeqID);
            }
            if (model.BillNo == null)
            {
                h.AddParameter("@BillNo", DBNull.Value);
            }
            else
            {
                h.AddParameter("@BillNo", model.BillNo);
            }
            if (model.RegDate == null)
            {
                h.AddParameter("@RegDate", DateTime.Now);
            }
            else
            {
                h.AddParameter("@RegDate", model.RegDate);
            }
            if (model.UserCount == null)
            {
                h.AddParameter("@UserCount", DBNull.Value);
            }
            else
            {
                h.AddParameter("@UserCount", model.UserCount);
            }
            if (model.Location == null)
            {
                h.AddParameter("@Location", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Location", model.Location);
            }
            int    result;
            string obj = h.ExecuteScalar();

            if (!int.TryParse(obj, out result))
            {
                return(0);
            }
            return(result);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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());
        }