コード例 #1
0
        protected void PrepareForm()
        {
            RSH_BaziLogicMod m_logic = RSH_BaziLogicBll.GetInstance().GetModel(sysno);

            txtTitle.Text         = m_logic.Name;
            txtDesc.Text          = m_logic.Description;
            drpType.SelectedIndex = drpType.Items.IndexOf(drpType.Items.FindByValue(m_logic.Type.ToString()));

            string[] logic = m_logic.Logic.Split(new char[] { '_' });
            ConditionList = RSH_BaziConditionBll.GetInstance().GetListByLogic(sysno);
            ConditionList.Columns.Add("sign1");
            ConditionList.Columns.Add("sign2");
            ConditionList.Columns.Add("sign");
            ConditionList.Columns.Add("logic");
            for (int i = 0; i < logic.Length / 4; i++)
            {
                if (logic[4 * i + 1].Contains("#"))
                {
                    DataRow m_dr = ConditionList.NewRow();
                    ConditionList.Rows.InsertAt(m_dr, i);
                    ConditionList.Rows[i]["logic"] = logic[4 * i + 1].Replace("#", "");
                }
                else
                {
                    ConditionList.Rows[i]["logic"] = "";
                }
                ConditionList.Rows[i]["sign1"] = logic[4 * i];
                ConditionList.Rows[i]["sign2"] = logic[4 * i + 2];
                ConditionList.Rows[i]["sign"]  = logic[4 * i + 3];
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 初始化
            //Login(Request.RawUrl);
            WebForAnalyse.Master.AdminMaster m_master = (WebForAnalyse.Master.AdminMaster) this.Master;
            m_master.PageName = "八字组合设置";
            m_master.SetCate(WebForAnalyse.Master.AdminMaster.CateType.BaZi3);
            #endregion
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                sysno = int.Parse(Request.QueryString["id"]);
            }
            if (!IsPostBack)
            {
                drpType.DataSource     = AppEnum.GetBaZiLogicType();
                drpType.DataTextField  = "value";
                drpType.DataValueField = "key";
                drpType.DataBind();
                drpType.Items.Insert(0, new ListItem("请选择", "-1"));

                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    PrepareForm();
                }

                int total = 0;
                LogicList = RSH_BaziLogicBll.GetInstance().GetList(1000, 1, "", sysno, ref total);

                DataTable m_dt = new DataTable();
                m_dt.Columns.Add("id");
                for (int i = 0; i < 50; i++)
                {
                    DataRow m_dr = m_dt.NewRow();
                    m_dr["id"] = i;
                    m_dt.Rows.Add(m_dr);
                }
                Repeater1.DataSource = m_dt;
                Repeater1.DataBind();

                //this.ClientScript.RegisterStartupScript(this.GetType(), "", "show(0);", true);
            }
            string jsstr = "";
            for (int i = 0; i <= int.Parse(HiddenField1.Value); i++)
            {
                jsstr += "show(" + i + ");";
            }
            string[] tmpstrs = HiddenField2.Value.Substring(1).Split(new char[] { '|' });
            for (int i = 0; i < tmpstrs.Length; i++)
            {
                jsstr += "convert(" + tmpstrs[i] + ");";
            }
            ScriptManager.RegisterStartupScript(UpdatePanel2, UpdatePanel2.GetType(), "", jsstr, true);
        }
コード例 #3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Delete()
        {
            try
            {
                RSH_BaziLogicMod m_logic = RSH_BaziLogicBll.GetInstance().GetModel(int.Parse(Request.QueryString["delete"]));
                m_logic.DR = (int)AppEnum.State.deleted;
                RSH_BaziLogicBll.GetInstance().Update(m_logic);

                ltrNotice.Text = "该记录已删除!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
            }
            catch
            {
                ltrError.Text = "系统错误,删除失败!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';", true);
            }
        }
コード例 #4
0
        protected void BindContent()
        {
            DataTable m_dt = RSH_BaziLogicBll.GetInstance().GetList(AppConst.PageSize, pageindex, txtName.Text.Trim(), AppConst.IntNull, ref total);

            m_dt.Columns.Add("deleteurl");
            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                m_dt.Rows[i]["deleteurl"] = urlnow + "&delete=";
            }
            rptFamous.DataSource = m_dt;
            rptFamous.DataBind();

            Pager1.url = "PatternList.aspx?name=" + txtName.Text.Trim() + "&pn=";
            if (total % AppConst.PageSize == 0)
            {
                this.Pager1.total = total / AppConst.PageSize;
            }
            else
            {
                this.Pager1.total = total / AppConst.PageSize + 1;
            }
            this.Pager1.index    = pageindex;
            this.Pager1.numlenth = 3;
        }
コード例 #5
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            #region 输入检查
            int count = 0;
            foreach (RepeaterItem item in Repeater1.Items)
            {
                if (item.ItemIndex > int.Parse(HiddenField1.Value))
                {
                    continue;
                }
                if (((TextBox)item.FindControl("txtSign1")).Text.Trim().Replace("(", "").Replace(")", "").Replace("(", "").Replace(")", "") != "")
                {
                    ltrError.Text = "输入框只可输入括号";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                    return;
                }
                if (((TextBox)item.FindControl("txtSign2")).Text.Trim().Replace("(", "").Replace(")", "").Replace("(", "").Replace(")", "") != "")
                {
                    ltrError.Text = "输入框只可输入括号";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                    return;
                }
                if (HiddenField2.Value.Contains("|" + item.ItemIndex + "|") && ((DropDownList)item.FindControl("drpLogic")).SelectedValue == "-1")
                {
                    ltrError.Text = "有逻辑选择框未选择";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                    return;
                }
                if (!HiddenField2.Value.Contains("|" + item.ItemIndex + "|") && ((DropDownList)item.FindControl("drpItem")).SelectedValue == "-1")
                {
                    ltrError.Text = "有主语选择框未选择";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                    return;
                }
                string tmpstr = ((TextBox)item.FindControl("txtSign1")).Text.Trim() + ((TextBox)item.FindControl("txtSign2")).Text.Trim();
                foreach (char c in tmpstr)
                {
                    if (c == '(' || c == '(')
                    {
                        count++;
                    }
                    if (c == ')' || c == ')')
                    {
                        count--;
                    }
                }
            }
            if (count != 0)
            {
                ltrError.Text = "括号开闭数量不对称";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }

            if (drpType.SelectedValue == "-1")
            {
                ltrError.Text = "请选择类型";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            if (txtTitle.Text.Trim() == "")
            {
                ltrError.Text = "请输入标题";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            if (txtDesc.Text.Trim() == "")
            {
                ltrError.Text = "请输入注释";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            #endregion


            RSH_BaziLogicMod m_logic = new RSH_BaziLogicMod();
            if (sysno == AppConst.IntNull)
            {
                m_logic.Description = txtDesc.Text.Trim();
                m_logic.DR          = (int)AppEnum.State.normal;
                m_logic.Name        = txtTitle.Text.Trim();
                m_logic.Type        = int.Parse(drpType.SelectedValue);
                m_logic.Logic       = "";
                m_logic.SysNo       = RSH_BaziLogicBll.GetInstance().Add(m_logic);
            }
            else
            {
                m_logic             = RSH_BaziLogicBll.GetInstance().GetModel(sysno);
                m_logic.Description = txtDesc.Text.Trim();
                m_logic.DR          = (int)AppEnum.State.normal;
                m_logic.Name        = txtTitle.Text.Trim();
                m_logic.Type        = int.Parse(drpType.SelectedValue);
                m_logic.Logic       = "";
                RSH_BaziConditionBll.GetInstance().DeleteConditionsByLogic(sysno);
            }
            //List<RSH_BaziConditionMod> m_condtions = new List<RSH_BaziConditionMod>();
            foreach (RepeaterItem item in Repeater1.Items)
            {
                if (item.ItemIndex > int.Parse(HiddenField1.Value))
                {
                    continue;
                }
                m_logic.Logic += ((TextBox)item.FindControl("txtSign1")).Text + "_";
                if (HiddenField2.Value.Contains("|" + item.ItemIndex + "|"))
                {
                    m_logic.Logic += "#" + ((DropDownList)item.FindControl("drpLogic")).SelectedValue + "_";
                }
                else if (((DropDownList)item.FindControl("drpItem")).Style["display"] != "none")
                {
                    RSH_BaziConditionMod tmp_c = new RSH_BaziConditionMod();
                    tmp_c.Item       = int.Parse(((DropDownList)item.FindControl("drpItem")).SelectedValue);
                    tmp_c.LogicSysNo = m_logic.SysNo;
                    tmp_c.Type       = int.Parse(((DropDownList)item.FindControl("drpType")).SelectedValue);
                    tmp_c.Condition  = int.Parse(((DropDownList)item.FindControl("drpCondition")).SelectedValue);
                    tmp_c.Target     = int.Parse(((DropDownList)item.FindControl("drpTarget")).SelectedValue);
                    tmp_c.Negative   = int.Parse(((DropDownList)item.FindControl("drpNegative")).SelectedValue);

                    tmp_c.SysNo    = RSH_BaziConditionBll.GetInstance().Add(tmp_c);
                    m_logic.Logic += "@" + tmp_c.SysNo + "_";
                }
                m_logic.Logic += ((TextBox)item.FindControl("txtSign2")).Text + "_";
                m_logic.Logic += ((DropDownList)item.FindControl("drpSign")).SelectedValue + "_";
            }
            m_logic.Logic = m_logic.Logic.Substring(0, m_logic.Logic.Length - 1);
            RSH_BaziLogicBll.GetInstance().Update(m_logic);
        }