예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PARENT = this.Get_Parent();
     if (!Page.IsPostBack)
     {
         this.Init_State();
         this.Load_Info(CCommon.Get_QueryNumber(Queryparam.Iid));
     }
 }
예제 #2
0
        private void Move_Info(CategoryattrInfo source_info, int dest_cid, int dest_pid, int dest_depth, bool getchild, CCategoryattr BLL)
        {
            if (source_info == null) return;
            int offset_depth = source_info.Depth - (dest_depth + 1);

            CategoryattrInfo info_copy = source_info.copy();
            info_copy.Cid = dest_cid;
            info_copy.Pid = dest_pid;
            info_copy.Depth = dest_depth + 1;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Username = CCommon.Get_CurrentUsername();
            info_copy.Timeupdate = DateTime.Now;
            if (BLL.Save(info_copy))
            {
                //BLL.Updatenum(dest_pid.ToString(), Queryparam.Sqlcolumn.Pis, 1);

                List<CategoryattrInfo> listin = null;
                List<CategoryattrInfo> listsub = BLL.Wcmm_Getlist_sub(source_info.Id, listin);
                if (listsub != null && listsub.Count > 0)
                {
                    foreach (CategoryattrInfo info_sub in listsub)
                    {
                        info_sub.Cid = getchild ? dest_cid : source_info.Cid;
                        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.Username = CCommon.Get_CurrentUsername();
                        info_sub.Timeupdate = DateTime.Now;
                        BLL.Save(info_sub);
                    }
                }
            }
        }
예제 #3
0
        private void Copy_Info(CategoryattrInfo source_info, int dest_cid, int dest_pid, int dest_depth, bool getchild, CCategoryattr BLL)
        {
            if (source_info == null) return;

            CategoryattrInfo info_copy = source_info.copy();
            info_copy.Id = 0;
            info_copy.Cid = dest_cid;
            info_copy.Pid = dest_pid;
            info_copy.Depth = dest_depth + 1;
            info_copy.Status = CCommon.GetStatus_upt();
            info_copy.Username = CCommon.Get_CurrentUsername();
            info_copy.Timeupdate = DateTime.Now;
            info_copy.Orderd = 0;
            info_copy.Pis = getchild ? info_copy.Pis : (info_copy.Pis > 0 ? 1 : 0);
            if (BLL.Save(info_copy))
            {
                //BLL.Updatenum(dest_pid.ToString(), Queryparam.Sqlcolumn.Pis, 1);
                if (getchild)
                {
                    List<CategoryattrInfo> listsub = BLL.Wcmm_Getlist(source_info.Cid, source_info.Id, Get_ListOptionsNoPaging());
                    if (listsub == null || listsub.Count == 0) return;
                    foreach (CategoryattrInfo info_sub in listsub)
                    {
                        this.Copy_Info(info_sub, dest_cid, info_copy.Id, info_copy.Depth, getchild, BLL);
                    }
                }
            }
        }
예제 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PARENT = this.Get_Parent();
     if (!Page.IsPostBack)
     {
         this.Init_State();
         this.Bind_grdView();
     }
 }
예제 #5
0
 private void setParameter(iSqlParameter[] parms, CategoryattrInfo info)
 {
     try
     {
         int i = -1;
         parms[++i].Value = CFunctions.SetDBString(info.Code);
         parms[++i].Value = CFunctions.SetDBString(info.Name);
         parms[++i].Value = CFunctions.SetDBString(info.Note);
         parms[++i].Value = CFunctions.SetDBString(info.Url);
         parms[++i].Value = CFunctions.SetDBString(info.Filepreview);
         parms[++i].Value = info.Cid;
         parms[++i].Value = info.Orderd == 0 ? info.Id : info.Orderd;
         parms[++i].Value = info.Status;
         parms[++i].Value = info.Markas;
         parms[++i].Value = info.Iconex;
         parms[++i].Value = CFunctions.SetDBDatetime(info.Timeupdate);
         parms[++i].Value = CFunctions.SetDBString(info.Username);
         parms[++i].Value = info.Pis;
         parms[++i].Value = info.Pid;
         parms[++i].Value = info.Depth;
         parms[++i].Value = CFunctions.install_keyword(info.Name) + " " + CFunctions.install_keyword(info.Note);
         parms[++i].Value = info.Id;
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #6
0
 private bool Saveitem(iSqlTransaction trans, CategoryattrInfo 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;
     }
 }
예제 #7
0
        private CategoryattrInfo getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                CategoryattrInfo info = new CategoryattrInfo();
                info.Code = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Note = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Url = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Filepreview = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Cid = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Orderd = dar.IsDBNull(++i) ? 0 : dar.GetInt32(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.Iconex = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Timeupdate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Username = dar.IsDBNull(++i) ? string.Empty : dar.GetString(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.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Rownumber = dar.IsDBNull(++i) ? 0 : dar.GetInt64(i);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #8
0
        public bool Save(CategoryattrInfo 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;
            }
        }
예제 #9
0
 private CategoryattrInfo Take()
 {
     try
     {
         int iid = 0;
         int.TryParse(txtId.Value, out iid);
         CategoryattrInfo info = (new CCategoryattr(CCommon.LANG)).Wcmm_Getinfo(iid);
         if (info == null)
             info = new CategoryattrInfo();
         info.Id = iid;
         info.Name = txtName.Text.Trim();
         info.Code = txtCode.Text.Trim();
         info.Url = txtUrl.Text.Trim();
         info.Note = txtNote.Text.Trim();
         info.Cid = int.Parse(ddlCid.SelectedValue);
         info.Pis = chkPis.Checked ? (chkPis.ToolTip == "0" ? 1 : int.Parse(chkPis.ToolTip)) : 0;
         if (PARENT != null)
         {
             info.Pid = PARENT.Id;
             info.Depth = PARENT.Depth + 1;
         }
         else
         {
             info.Depth = info.Pid != 0 ? info.Depth : 1;
         }
         info.Filepreview = Filepreview.Get();
         info.Iconex = Displaysetting.Get_Icon();
         info.Status = Displaysetting.Get_Status();
         info.Orderd = Displaysetting.Get_Orderd();
         info.Markas = Displaysetting.Get_Markas();
         info.Username = CCommon.Get_CurrentUsername();
         info.Timeupdate = DateTime.Now;
         return info;
     }
     catch
     {
         return null;
     }
 }
예제 #10
0
        private bool Save_Lang(CategoryattrInfo 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;

                    CategoryattrInfo lang_info = info.copy();
                    lang_info.Id = 0;
                    lang_info.Status = (int)CConstants.State.Status.Waitactive;
                    (new CCategoryattr(lang_val)).Save(lang_info);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
예제 #11
0
 private bool Save(CategoryattrInfo info)
 {
     try
     {
         if (info == null) return false;
         int iid = info.Id;
         if ((new CCategoryattr(CCommon.LANG)).Save(info))
             if (PARENT != null && iid == 0)
                 (new CCategoryattr(CCommon.LANG)).Updatenum(PARENT.Id.ToString(), Queryparam.Sqlcolumn.Pis, CConstants.NUM_INCREASE);
         return true;
     }
     catch
     {
         return false;
     }
 }
예제 #12
0
        private bool Load_Info(int iid)
        {
            try
            {
                CategoryattrInfo info = null;
                if (iid != 0)
                {
                    info = (new CCategoryattr(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 CategoryattrInfo();
                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;
                txtUrl.Text = info.Url;
                txtNote.Text = info.Note;
                ddlCid.SelectedValue = PARENT != null ? PARENT.Cid.ToString() : (info.Cid != 0 ? info.Cid.ToString() : CCommon.Get_QueryNumber(Queryparam.Cid).ToString());
                chkPis.Checked = info.Pis != 0;
                chkPis.ToolTip = info.Pis.ToString();
                chkPis.Enabled = !(info.Pis > 1);
                chkPis.Text = CCommon.Get_Definephrase(Definephrase.Display_pis).Replace(Queryparam.Varstring.Depth, (PARENT == null ? 2 : PARENT.Depth + 2).ToString());
                Filepreview.Set(info.Filepreview);
                Displaysetting.Set(info.Iconex, info.Status, info.Orderd, info.Markas);

                return true;
            }
            catch
            {
                return false;
            }
        }
예제 #13
0
 private void Write_Categoryitem(StringBuilder write, CategoryattrInfo info)
 {
     write.Append("<span class=\"wrap" + (info.Depth == 1 ? " havesub" : "") + "\"><input type=\"checkbox\" name=\"chkcategoryattr\" id=\"chkcategoryattr" + info.Id + "\" value=\"" + info.Id + "\" " + this.Write_Checked(info.Id) + " /> <label for=\"chkcategoryattr" + info.Id + "\">" + info.Name + "</label></span>");
 }