示例#1
0
 private void setParameter(iSqlParameter[] parms, StaticcontentInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = CFunctions.SetDBString(info.Name);
         parms[++i].Value = CFunctions.SetDBString(info.Code);
         parms[++i].Value = info.Separatepage;
         parms[++i].Value = CFunctions.SetDBString(info.Filepath);
         parms[++i].Value = CFunctions.SetDBString(info.Description);
         parms[++i].Value = info.Status;
         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.Description);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
        private StaticcontentInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                StaticcontentInfo info = new StaticcontentInfo();
                info.Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Code = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Separatepage = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Filepath = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Description = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Status = dar.IsDBNull(++i) ? (int)CConstants.State.Status.Waitactive : 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) ? -1 : dar.GetInt64(i);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
 private bool Saveitem(iSqlTransaction trans, StaticcontentInfo 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;
     }
 }
示例#4
0
        public bool Save(StaticcontentInfo 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 StaticcontentInfo Take()
 {
     try
     {
         int iid = 0;
         int.TryParse(txtId.Value, out iid);
         StaticcontentInfo info = (new CStaticcontent(CCommon.LANG)).Wcmm_Getinfo(iid);
         if (info == null)
             info = new StaticcontentInfo();
         info.Id = iid;
         info.Name = txtName.Text.Trim();
         info.Code = txtCode.Text.Trim();
         info.Separatepage = chkSeparatepage.Checked ? 1 : 0;
         info.Filepath = txtFilepath.Text.Trim();
         info.Description = txtDescription.Text.Trim();
         info.Status = CCommon.GetStatus_upt();
         info.Username = CCommon.Get_CurrentUsername();
         info.Timeupdate = DateTime.Now;
         return info;
     }
     catch
     {
         return null;
     }
 }
        private bool Save_Lang(StaticcontentInfo 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;

                    StaticcontentInfo lang_info = info.copy();
                    lang_info.Id = 0;
                    lang_info.Status = (int)CConstants.State.Status.Waitactive;
                    if ((new CStaticcontent(lang_val)).Save(lang_info))
                        if (lang_info.Separatepage == 0)
                            this.Save_File(lang_val);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
 private bool Save(StaticcontentInfo info)
 {
     try
     {
         if (info == null) return false;
         if ((new CStaticcontent(CCommon.LANG)).Save(info))
         {
             if (info.Separatepage == 0)
                 this.Save_File(CCommon.LANG);
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
        private bool Load_Info(int iid)
        {
            try
            {
                StaticcontentInfo info = null;
                if (iid != 0)
                {
                    info = (new CStaticcontent(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 StaticcontentInfo();
                chkSaveoption_golist.Checked = info.Id != 0;
                chkSaveoption_golang.Checked = info.Id == 0;

                txtId.Value = info.Id.ToString();
                txtName.Text = info.Name;
                txtCode.Text = info.Code;
                chkSeparatepage.Checked = info.Separatepage == 1 ? true : false;
                txtFilepath.Text = info.Filepath;
                txtDescription.Text = info.Description;
                return true;
            }
            catch
            {
                return false;
            }
        }