Esempio n. 1
0
 private void setParameter(iSqlParameter[] parms, SupportonlineInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = CFunctions.SetDBString(info.Name);
         parms[++i].Value = info.Type;
         parms[++i].Value = CFunctions.SetDBString(info.Note);
         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.install_keyword(info.Name) + " " + CFunctions.install_keyword(info.Note);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
 private SupportonlineInfo getDataReader(iSqlDataReader dar)
 {
     try
     {
         int i = -1;
         SupportonlineInfo info = new SupportonlineInfo();
         info.Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
         info.Type = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
         info.Note = dar.IsDBNull(++i) ? string.Empty : dar.GetString(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.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
         info.Rownumber = dar.IsDBNull(++i) ? 0 : dar.GetInt64(i);
         return info;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 3
0
 private bool Saveitem(iSqlTransaction trans, SupportonlineInfo 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;
     }
 }
Esempio n. 4
0
        public bool Save(SupportonlineInfo 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;
            }
        }
        private bool Load_Info(int iid)
        {
            try
            {
                SupportonlineInfo info = null;
                if (iid != 0)
                {
                    info = (new CSupportonline(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 SupportonlineInfo();
                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;
                Displaysetting.Set("", info.Status, 0);
                return true;
            }
            catch
            {
                return false;
            }
        }
        private SupportonlineInfo Take()
        {
            try
            {
                int iid = 0;
                int.TryParse(txtId.Value, out iid);
                SupportonlineInfo info = (new CSupportonline(CCommon.LANG)).Wcmm_Getinfo(iid);
                if (info == null)
                    info = new SupportonlineInfo();
                info.Id = iid;

                info.Name = txtName.Text.Trim();
                info.Type = int.Parse(ddlType.SelectedValue);
                info.Note = txtNote.Text.Trim();
                info.Timeupdate = DateTime.Now;
                info.Status = Displaysetting.Get_Status();
                return info;
            }
            catch
            {
                return null;
            }
        }
        private bool Save_Lang(SupportonlineInfo 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;

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