Example #1
0
 private void setParameter(iSqlParameter[] parms, SymbolInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = CFunctions.SetDBString(info.Name);
         parms[++i].Value = CFunctions.SetDBString(info.Path);
         parms[++i].Value = CFunctions.SetDBString(info.Note);
         parms[++i].Value = info.Sized;
         parms[++i].Value = info.Status;
         parms[++i].Value = info.Orderd == 0 ? info.Id : info.Orderd;
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timeupdate);
         parms[++i].Value = CFunctions.SetDBString(info.Username);
         parms[++i].Value = CFunctions.install_keyword(info.Name) + " " + CFunctions.install_keyword(info.Note) + " " + CFunctions.install_keyword(info.Path);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
        private SymbolInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                SymbolInfo info = new SymbolInfo();
                info.Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Path = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Note = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Sized = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Status = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Orderd = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Timeupdate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Username = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Rownumber = dar.IsDBNull(++i) ? 0 : dar.GetInt64(i);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
 private bool Saveitem(iSqlTransaction trans, SymbolInfo info)
 {
     try
     {
         if (trans == null || info == null) return false;
         string SQL = string.Empty;
         if (info.Id == 0)
         {
             SQL = SQL_INSERT;
             info.Id = (int)HELPER.getNewID(trans, TABLENAME);
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         else if (HELPER.isExist(trans, TABLENAME, info.Id))
         {
             SQL = SQL_UPDATE;
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         else
         {
             SQL = SQL_INSERT;
             info.Id = (int)HELPER.getNewID(trans, TABLENAME);
             iSqlParameter[] parms = this.getParameter(SQL);
             this.setParameter(parms, info);
             HELPER.executeNonQuery(trans, iCommandType.Text, SQL, parms);
         }
         return true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
        public bool Save(SymbolInfo info)
        {
            try
            {
                using (iSqlConnection iConn = HELPER.getConnect(HELPER.SQL_SYSTEM))
                {
                    using (iSqlTransaction trans = iConn.BeginTransaction())
                    {
                        try
                        {
                            this.Saveitem(trans, info);

                            trans.Commit();
                        }
                        catch (Exception ex)
                        {
                            trans.Rollback();
                            throw ex;
                        }
                    }
                    iConn.Close();
                }
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        private bool Load_Info(int iid)
        {
            try
            {
                SymbolInfo info = null;
                if (iid != 0)
                {
                    info = (new CSymbol(CCommon.LANG)).Wcmm_Getinfo(iid);
                    if (info != null)
                    {
                        lstError = new List<Errorobject>();
                        lstError = Form_GetError(lstError, Errortype.Notice, Definephrase.Save_notice, "[" + info.Id + "] " + info.Name, null);
                        Master.Form_ShowError(lstError);
                    }
                }
                if (info == null)
                    info = new SymbolInfo();
                chkSaveoption_golist.Checked = info.Id != 0;
                chkSaveoption_golang.Checked = info.Id == 0;

                txtId.Value = info.Id.ToString();
                txtName.Text = info.Name;
                txtNote.Text = info.Note;
                Filepreview.Set(info.Path);
                Displaysetting.Set("", info.Status, 0);
                return true;
            }
            catch
            {
                return false;
            }
        }
Example #6
0
 private SymbolInfo Take()
 {
     try
     {
         int iid = 0;
         int.TryParse(txtId.Value, out iid);
         SymbolInfo info = (new CSymbol(CCommon.LANG)).Wcmm_Getinfo(iid);
         if (info == null)
             info = new SymbolInfo();
         info.Id = iid;
         info.Name = txtName.Text.Trim();
         info.Note = txtNote.Text.Trim();
         info.Path = Filepreview.Get();
         info.Username = CCommon.Get_CurrentUsername();
         info.Timeupdate = DateTime.Now;
         info.Status = Displaysetting.Get_Status();
         return info;
     }
     catch
     {
         return null;
     }
 }
Example #7
0
        private bool Save_Lang(SymbolInfo info)
        {
            try
            {
                if (!CFunctions.IsMultiLanguage() || !chkSaveoption_golang.Checked) return false;

                int lang_num = CConstants.LANG_NUM;
                for (int i = 0; i < lang_num; i++)
                {
                    string lang_val = ConfigurationSettings.AppSettings["LANG_" + i];
                    if (lang_val == CCommon.LANG) continue;

                    SymbolInfo lang_info = info.copy();
                    lang_info.Id = 0;
                    lang_info.Status = (int)CConstants.State.Status.Waitactive;
                    (new CSymbol(lang_val)).Save(lang_info);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
Example #8
0
 private bool Save(SymbolInfo info)
 {
     try
     {
         if (info == null) return false;
         return (new CSymbol(CCommon.LANG)).Save(info);
     }
     catch
     {
         return false;
     }
 }