예제 #1
0
        public static FormatStringGroup InitReportFormats(FormatStyle FormatStyle)
        {
            String            formatStyle = FormatStyle.ToString();
            FormatStringGroup Fsg         = new FormatStringGroup();
            StringBuilder     Sql_Select  = new StringBuilder();

            Sql_Select.Append("Select ID,FormatStyle,FormatString From sys_biz_ModuleFormatStrings Where FormatStyle='");
            Sql_Select.Append(formatStyle.ToString());
            Sql_Select.Append("'");
            Sql_Select.Append(" ORDER BY FormatString ASC ");
            DataTable Data = Agent.CallService("Yqun.BO.LoginBO.dll", "GetDataTable", new object[] { Sql_Select.ToString() }) as DataTable;

            if (Data != null && Data.Rows.Count > 0)
            {
                for (int i = 0; i < Data.Rows.Count; i++)
                {
                    FormatString Fs  = new FormatString();
                    DataRow      Row = Data.Rows[i];
                    Fs.Index = Row["ID"].ToString();
                    String FormatS = Row["FormatStyle"].ToString();
                    Fs.FormatStyle = (FormatStyle)Enum.Parse(typeof(FormatStyle), FormatS);
                    Fs.FormatValue = Row["FormatString"].ToString();
                    Fsg.FormatStrings.Add(Fs);
                }
            }

            return(Fsg);
        }
예제 #2
0
        private void Button_Append_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                return;
            }

            Boolean           Found = false;
            FormatStringGroup NowformatStringGroup = Groups[rButton_Style];

            for (int i = 0; i < NowformatStringGroup.FormatStrings.Count; i++)
            {
                if (NowformatStringGroup.FormatStrings[i].ToString() == textBox1.Text)
                {
                    Found = true;
                    break;
                }
            }

            if (!Found)
            {
                FormatString fs = new FormatString();
                fs.FormatValue = textBox1.Text;
                fs.FormatStyle = rButton_Style;

                DepositoryReportFormat.UpdateReportFormats(fs);
                NowformatStringGroup.FormatStrings.Add(fs);
                lBox_FormatString.Items.Add(fs);
                tBox_FormatString.Text = lBox_FormatString.Items[0].ToString();
                textBox1.Text          = "";
            }
        }
예제 #3
0
        private void ShowFormatString(FormatStyle formatStyle)
        {
            rButton_Style = formatStyle;

            #region 字典的实现

            lBox_FormatString.Items.Clear();
            tBox_FormatString.Text = "";
            label_Example.Text     = "";

            FormatStringGroup NowformatStringGroup = Groups[formatStyle];
            if (NowformatStringGroup != null)
            {
                for (int i = 0; i < NowformatStringGroup.FormatStrings.Count; i++)
                {
                    lBox_FormatString.Items.Add(NowformatStringGroup.FormatStrings[i]);
                }

                if (lBox_FormatString.Items.Count > 0)
                {
                    lBox_FormatString.SelectedIndex = 0;
                }
            }

            #endregion
        }
예제 #4
0
        public static Dictionary <FormatStyle, FormatStringGroup> InitReportFormats()
        {
            Dictionary <FormatStyle, FormatStringGroup> Groups = new Dictionary <FormatStyle, FormatStringGroup>();

            foreach (FormatStyle Format in Enum.GetValues(typeof(FormatStyle)))
            {
                FormatStringGroup group = InitReportFormats(Format);
                Groups.Add(Format, group);
            }

            return(Groups);
        }
예제 #5
0
        private void Button_Delete_Click(object sender, EventArgs e)
        {
            FormatString      fs  = (FormatString)lBox_FormatString.SelectedItem;
            FormatStringGroup Fsg = Groups[rButton_Style];

            if (fs != null)
            {
                if (DialogResult.Yes == MessageBox.Show("确定删除格式串 ‘" + fs.FormatValue + "’ 吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
                {
                    DepositoryReportFormat.DeleteReportFormats(fs);
                    lBox_FormatString.Items.Remove(lBox_FormatString.SelectedItem);
                    Fsg.FormatStrings.Remove(fs);
                    if (lBox_FormatString.Items.Count > 0)
                    {
                        lBox_FormatString.SelectedIndex = 0;
                    }
                    else
                    {
                        tBox_FormatString.Text = "";
                    }
                }
            }
        }