예제 #1
0
 /// <summary>
 /// get table record
 /// <summary>
 /// <param name=inouttype>inouttype</param>
 /// <param name=out emsg>return error message</param>
 ///<returns>get a record detail of warehouseinouttype</returns>
 public modWarehouseInoutType GetItem(string inouttype, out string emsg)
 {
     try
     {
         //Execute a query to read the categories
         string sql = string.Format("select inout_type,inout_flag,lock_flag,update_user,update_time from warehouse_inout_type where inout_type='{0}' order by inout_type", inouttype);
         using (SqlDataReader rdr = SqlHelper.ExecuteReader(sql))
         {
             if (rdr.Read())
             {
                 modWarehouseInoutType model = new modWarehouseInoutType();
                 model.InoutType  = dalUtility.ConvertToString(rdr["inout_type"]);
                 model.InoutFlag  = dalUtility.ConvertToInt(rdr["inout_flag"]);
                 model.LockFlag   = dalUtility.ConvertToInt(rdr["lock_flag"]);
                 model.UpdateUser = dalUtility.ConvertToString(rdr["update_user"]);
                 model.UpdateTime = dalUtility.ConvertToString(rdr["update_time"]);
                 emsg             = null;
                 return(model);
             }
             else
             {
                 emsg = "Error on read data";
                 return(null);
             }
         }
     }
     catch (Exception ex)
     {
         emsg = dalUtility.ErrorMessage(ex.Message);
         return(null);
     }
 }
예제 #2
0
 /// <summary>
 /// update a warehouseinoutform
 /// <summary>
 /// <param name=id>id</param>
 /// <param name=mod>model object of warehouseinoutform</param>
 /// <param name=out emsg>return error message</param>
 /// <returns>true/false</returns>
 public bool Update(int id, modWarehouseInoutForm mod, out string emsg)
 {
     try
     {
         dalWarehouseInoutType daltype = new dalWarehouseInoutType();
         modWarehouseInoutType modtype = daltype.GetItem(mod.InoutType, out emsg);
         string sql = string.Format("update warehouse_inout_form set inout_type='{0}',inout_flag={1},inout_date='{2}',status={3},warehouse_id='{4}',product_id='{5}',product_name='{6}',size={7},qty={8},price={9},remark='{10}',no='{11}',price_status={12} where id={13}", mod.InoutType, modtype.InoutFlag, mod.InoutDate, mod.Status, mod.WarehouseId, mod.ProductId, mod.ProductName, mod.Size, mod.Qty, mod.CostPrice, mod.Remark, mod.No, 0, id);
         int    i   = SqlHelper.ExecuteNonQuery(sql);
         if (i > 0)
         {
             emsg = null;
             return(true);
         }
         else
         {
             emsg = "Unknown error when ExecuteNonQuery!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         emsg = dalUtility.ErrorMessage(ex.Message);
         return(false);
     }
 }
예제 #3
0
 /// <summary>
 /// get all warehouseinouttype
 /// <summary>
 /// <param name=inouttype>inouttype</param>
 /// <param name=out emsg>return error message</param>
 ///<returns>details of all warehouseinouttype</returns>
 public BindingCollection <modWarehouseInoutType> GetIList(int?inoutflag, out string emsg)
 {
     try
     {
         BindingCollection <modWarehouseInoutType> modellist = new BindingCollection <modWarehouseInoutType>();
         //Execute a query to read the categories
         string sql = string.Format("select inout_type,inout_flag,lock_flag,update_user,update_time from warehouse_inout_type where inout_flag={0} order by seq", inoutflag);
         using (SqlDataReader rdr = SqlHelper.ExecuteReader(sql))
         {
             while (rdr.Read())
             {
                 modWarehouseInoutType model = new modWarehouseInoutType();
                 model.InoutType  = dalUtility.ConvertToString(rdr["inout_type"]);
                 model.InoutFlag  = dalUtility.ConvertToInt(rdr["inout_flag"]);
                 model.LockFlag   = dalUtility.ConvertToInt(rdr["lock_flag"]);
                 model.UpdateUser = dalUtility.ConvertToString(rdr["update_user"]);
                 model.UpdateTime = dalUtility.ConvertToString(rdr["update_time"]);
                 modellist.Add(model);
             }
         }
         emsg = null;
         return(modellist);
     }
     catch (Exception ex)
     {
         emsg = dalUtility.ErrorMessage(ex.Message);
         return(null);
     }
 }
예제 #4
0
 /// <summary>
 /// insert a warehouseinoutform
 /// <summary>
 /// <param name=mod>model object of warehouseinoutform</param>
 /// <param name=out emsg>return error message</param>
 /// <returns>true/false</returns>
 public bool Insert(modWarehouseInoutForm mod, out string emsg)
 {
     try
     {
         dalWarehouseInoutType daltype = new dalWarehouseInoutType();
         modWarehouseInoutType modtype = daltype.GetItem(mod.InoutType, out emsg);
         string sql = string.Format("insert into warehouse_inout_form(inout_type,inout_flag,inout_date,status,warehouse_id,product_id,product_name,size,qty,price,remark,update_user,update_time,no)values('{0}',{1},'{2}',{3},'{4}','{5}','{6}',{7},{8},{9},'{10}','{11}',getdate(),'{12}')", mod.InoutType, modtype.InoutFlag, mod.InoutDate, mod.Status, mod.WarehouseId, mod.ProductId, mod.ProductName, mod.Size, mod.Qty, mod.CostPrice, mod.Remark, mod.UpdateUser, mod.No);
         int    i   = SqlHelper.ExecuteNonQuery(sql);
         if (i > 0)
         {
             emsg = null;
             return(true);
         }
         else
         {
             emsg = "Unknown error when ExecuteNonQuery!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         emsg = dalUtility.ErrorMessage(ex.Message);
         return(false);
     }
 }
예제 #5
0
 protected override void Find()
 {
     for (int i = 0; i < DBGrid.Rows.Count; i++)
     {
         modWarehouseInoutType mod = (modWarehouseInoutType)DBGrid.Rows[i].DataBoundItem;
         if (mod.InoutType.CompareTo(FindText) == 0)
         {
             DBGrid.CurrentCell = DBGrid.Rows[i].Cells[0];
             return;
         }
     }
 }