Ejemplo n.º 1
0
 /// <summary>
 /// get table record
 /// <summary>
 /// <param name=digesttype>digesttype</param>
 /// <param name=out emsg>return error message</param>
 ///<returns>get a record detail of acccommondigesttype</returns>
 public modAccCommonDigestType GetItem(string digesttype, out string emsg)
 {
     try
     {
         //Execute a query to read the categories
         string sql = string.Format("select digest_type,update_user,update_time from acc_common_digest_type where digest_type='{0}' order by digest_type", digesttype);
         using (SqlDataReader rdr = SqlHelper.ExecuteReader(sql))
         {
             if (rdr.Read())
             {
                 modAccCommonDigestType model = new modAccCommonDigestType();
                 model.DigestType = dalUtility.ConvertToString(rdr["digest_type"]);
                 model.UpdateUser = dalUtility.ConvertToString(rdr["update_user"]);
                 model.UpdateTime = dalUtility.ConvertToDateTime(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);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// get all acccommondigesttype
 /// <summary>
 /// <param name=out emsg>return error message</param>
 ///<returns>details of all acccommondigesttype</returns>
 public BindingCollection <modAccCommonDigestType> GetIList(out string emsg)
 {
     try
     {
         BindingCollection <modAccCommonDigestType> modellist = new BindingCollection <modAccCommonDigestType>();
         //Execute a query to read the categories
         string sql = "select digest_type,update_user,update_time from acc_common_digest_type order by digest_type";
         using (SqlDataReader rdr = SqlHelper.ExecuteReader(sql))
         {
             while (rdr.Read())
             {
                 modAccCommonDigestType model = new modAccCommonDigestType();
                 model.DigestType = dalUtility.ConvertToString(rdr["digest_type"]);
                 model.UpdateUser = dalUtility.ConvertToString(rdr["update_user"]);
                 model.UpdateTime = dalUtility.ConvertToDateTime(rdr["update_time"]);
                 modellist.Add(model);
             }
         }
         emsg = null;
         return(modellist);
     }
     catch (Exception ex)
     {
         emsg = dalUtility.ErrorMessage(ex.Message);
         return(null);
     }
 }
Ejemplo n.º 3
0
 private void DBGrid_SelectionChanged(object sender, EventArgs e)
 {
     if (DBGrid.CurrentRow != null)
     {
         modAccCommonDigestType mod = (modAccCommonDigestType)DBGrid.CurrentRow.DataBoundItem;
         txtDigestType.Text = mod.DigestType;
         FindText           = mod.DigestType;
     }
 }
Ejemplo n.º 4
0
 protected override void Find()
 {
     for (int i = 0; i < DBGrid.Rows.Count; i++)
     {
         modAccCommonDigestType mod = (modAccCommonDigestType)DBGrid.Rows[i].DataBoundItem;
         if (mod.DigestType.CompareTo(FindText) == 0)
         {
             DBGrid.CurrentCell = DBGrid.Rows[i].Cells[0];
             DBGrid_SelectionChanged(null, null);
             return;
         }
     }
 }
Ejemplo n.º 5
0
 protected override bool Save()
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (string.IsNullOrEmpty(txtDigestType.Text.Trim()))
         {
             MessageBox.Show(clsTranslate.TranslateString("Digest type") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             txtDigestType.Focus();
             return(false);
         }
         modAccCommonDigestType mod = new modAccCommonDigestType(txtDigestType.Text.Trim(), Util.UserId, DateTime.Now);
         bool ret = false;
         if (_status == 1)
         {
             ret = _dal.Insert(mod, out Util.emsg);
         }
         else if (_status == 2)
         {
             ret = _dal.Update(txtDigestType.Text, mod, out Util.emsg);
         }
         if (ret)
         {
             Util.ChangeStatus(this, true);
             DBGrid.Enabled = true;
             LoadData();
             FindText = mod.DigestType;
             Find();
         }
         return(ret);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         return(false);
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// insert a acccommondigesttype
 /// <summary>
 /// <param name=mod>model object of acccommondigesttype</param>
 /// <param name=out emsg>return error message</param>
 /// <returns>true/false</returns>
 public bool Insert(modAccCommonDigestType mod, out string emsg)
 {
     try
     {
         string sql = string.Format("insert into acc_common_digest_type(digest_type,update_user,update_time)values('{0}','{1}',getdate())", mod.DigestType, mod.UpdateUser);
         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);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// update a acccommondigesttype
 /// <summary>
 /// <param name=digesttype>digesttype</param>
 /// <param name=mod>model object of acccommondigesttype</param>
 /// <param name=out emsg>return error message</param>
 /// <returns>true/false</returns>
 public bool Update(string digesttype, modAccCommonDigestType mod, out string emsg)
 {
     try
     {
         string sql = string.Format("update acc_common_digest_type set update_user='******',update_time=getdate() where digest_type='{1}'", mod.UpdateUser, digesttype);
         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);
     }
 }