示例#1
0
 /// <summary>
 /// 删除选中的项目
 /// </summary>
 /// <param name="select"></param>
 public void DeleteStoreStruct(params string[] select)
 {
     using (StoreAccess access = new StoreAccess(true))
     {
         string strSQL = string.Empty;
         try
         {
             access.Open();
             access.BeginTransaction();
             if (select[0] == "全部删除")
             {
                 strSQL = access.CommandFormate("DELETE FROM [dbo].[Table_Warehouse]");
                 access.Delete(strSQL);
             }
             else
             {
                 strSQL = access.CommandFormate("DELETE FROM [dbo].[Table_Warehouse] WHERE [Row] = {0}Row AND [Column] = {0}Column AND [Layer] = {0}Layer");
                 access.Delete(strSQL, parmater =>
                 {
                     parmater.Add(parmater.CreateParameter("Row", select[1]));
                     parmater.Add(parmater.CreateParameter("Column", select[2]));
                     parmater.Add(parmater.CreateParameter("Layer", select[3]));
                 });
             }
             access.Commit();
         }
         catch (DbException dbe)
         {
             LogBusiness.RecordLog("管理员", dbe.Message, "删除仓库结构数据操作异常");
         }
     }
 }
示例#2
0
        /// <summary>
        /// 删除用户怇
        /// </summary>
        /// <param name="acount"></param>
        /// <param name="type">1:条件删除 2:全部删除</param>
        /// <returns></returns>
        public int DeleteAcount(object acount, int type)
        {
            int    num = 0;
            string sql = string.Empty;

            if (type == 1)
            {
                sql = string.Format("DELETE FROM [Table_User] WHERE [Id] = {0}", acount);
            }
            else
            {
                sql = "DELETE FROM [Table_User]";
            }
            using (StoreAccess access = new StoreAccess(true))
            {
                try
                {
                    access.Open();
                    access.BeginTransaction();
                    num = access.Delete(sql);
                    access.Commit();
                }
                catch (Exception ex)
                {
                    access.RollBack();
                    access.Close();
                }
            }
            return(num);
        }