Пример #1
0
        protected void cmdCreateFolder_Click(object sender, EventArgs e)
        {
            try
            {
                FeedbackInfo info = new FeedbackInfo();
                info.Sender_Name = info.Sender_Email = info.Sender_Address = info.Sender_Phone = info.Description = "";
                info.Name = txtFolderName.Text.Trim();
                info.Timeupdate = DateTime.Now;
                info.Pis = 1;
                if ((new CFeedback()).Save(info))
                {
                    cmdCreateFolder.Visible = txtFolderName.Visible = false;

                    txtKeyword.Text = "";
                    this.Bind_grdView();
                }
            }
            catch (Exception ex)
            {
                CCommon.CatchEx(ex);
            }
        }
Пример #2
0
 private void setParameter(iSqlParameter[] parms, FeedbackInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = CFunctions.SetDBString(info.Name);
         parms[++i].Value = CFunctions.SetDBString(info.Description);
         parms[++i].Value = CFunctions.SetDBString(info.Sender_Name);
         parms[++i].Value = CFunctions.SetDBString(info.Sender_Address);
         parms[++i].Value = CFunctions.SetDBString(info.Sender_Email);
         parms[++i].Value = CFunctions.SetDBString(info.Sender_Phone);
         parms[++i].Value = info.Status;
         parms[++i].Value = info.Markas;
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timeupdate);
         parms[++i].Value = info.Pis;
         parms[++i].Value = info.Pid;
         parms[++i].Value = info.Depth;
         parms[++i].Value = info.Viewcounter;
         parms[++i].Value = CFunctions.install_keyword(info.Sender_Name) + " " + CFunctions.install_keyword(info.Name) + " " + CFunctions.install_keyword(info.Description);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
 private bool Saveitem(iSqlTransaction trans, FeedbackInfo 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
        private FeedbackInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                FeedbackInfo info = new FeedbackInfo();
                info.Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Description = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Sender_Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Sender_Address = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Sender_Email = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Sender_Phone = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Status = dar.IsDBNull(++i) ? (int)CConstants.State.Status.Waitactive : dar.GetInt32(i);
                info.Markas = dar.IsDBNull(++i) ? (int)CConstants.State.MarkAs.None : dar.GetInt32(i);
                info.Timeupdate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Pis = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Pid = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Depth = dar.IsDBNull(++i) ? 1 : dar.GetInt32(i);
                info.Viewcounter = dar.IsDBNull(++i) ? 0 : dar.GetInt32(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;
            }
        }
Пример #5
0
        public bool Save(FeedbackInfo 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;
            }
        }
Пример #6
0
        private FeedbackInfo Take()
        {
            try
            {
                FeedbackInfo info = new FeedbackInfo();
                info.Sender_Name = txtSender_Nickname.Text.Trim();
                info.Sender_Email = txtSender_Email.Text.Trim();
                //info.Sender_Address = txtSender_Address.Text.Trim();
                info.Sender_Phone = txtSender_Phone.Text.Trim();
                info.Name = txtName.Text.Trim();
                info.Description = txtDescription.Text.Trim();
                info.Timeupdate = DateTime.Now;

                return info;
            }
            catch
            {
                return null;
            }
        }
Пример #7
0
        private void Move_Info(FeedbackInfo source_info, int dest_pid, int dest_depth, bool getchild, CFeedback BLL)
        {
            if (source_info == null) return;
            int offset_depth = source_info.Depth - (dest_depth + 1);

            FeedbackInfo info_copy = source_info.copy();
            info_copy.Pid = dest_pid;
            info_copy.Depth = dest_depth + 1;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Timeupdate = DateTime.Now;
            if (BLL.Save(info_copy))
            {
                List<FeedbackInfo> listin = null;
                List<FeedbackInfo> listsub = BLL.Getlist_sub(source_info.Id, listin);
                if (listsub != null && listsub.Count > 0)
                {
                    foreach (FeedbackInfo info_sub in listsub)
                    {
                        info_sub.Pid = getchild ? info_sub.Pid : (info_sub.Pid == source_info.Id ? source_info.Pid : info_sub.Pid);
                        info_sub.Depth = getchild ? info_sub.Depth + offset_depth : info_sub.Depth - 1;
                        info_sub.Status = CCommon.GetStatus_upt();
                        info_sub.Timeupdate = DateTime.Now;
                        BLL.Save(info_sub);
                    }
                }
            }
        }
Пример #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PARENT = this.Get_Parent();
     if (!Page.IsPostBack)
     {
         this.Init_State();
         this.Bind_grdView();
     }
 }