示例#1
0
        private void Flush()
        {
            IBLL.IPrint bll = new BLL.PrintBLL();
            DataTable   tb  = bll.GetAll(print_style);

            this.dataGrid1.DataSource = tb;
        }
示例#2
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dataGrid1.CurrentRow() == null)
                {
                    return;
                }

                if ("1".Equals(this.dataGrid1.CurrentRow()["is_base"].ToString()))
                {
                    MsgForm.ShowFrom("系统样式不可删除");
                    return;
                }

                if (YesNoForm.ShowFrom("确认要删除样式[" + this.dataGrid1.CurrentRow()["style_name"] + "]") == DialogResult.Yes)
                {
                    IBLL.IPrint bll = new BLL.PrintBLL();
                    PrintHelper.DelStyle(this.dataGrid1.CurrentRow()["style_id"].ToString());
                    bll.Del(new sys_t_print_style()
                    {
                        style_id = this.dataGrid1.CurrentRow()["style_id"].ToString(), update_time = DateTime.Now
                    });
                    Flush();
                }
            }
            catch (Exception exception)
            {
                MsgForm.ShowFrom(exception);
            }
        }
示例#3
0
        public static void SaveStyle()
        {
            try
            {
                List <Model.sys_t_print_style_data> lis = new List <Model.sys_t_print_style_data>();

                foreach (Model.sys_t_print_style style in myStyle.Values)
                {
                    using (StreamReader sr = new StreamReader(style_path + style.style_data + ".txt", Encoding.UTF8))
                    {
                        string txt = sr.ReadToEnd();
                        lis.Add(new Model.sys_t_print_style_data()
                        {
                            style_data = style.style_data,
                            style_str  = txt,
                        });
                    }
                }

                IBLL.IPrint bll = new BLL.PrintBLL();
                bll.UpdateStyleData(lis);
            }
            catch (Exception e)
            {
                MsgForm.ShowFrom(e);
            }
        }
示例#4
0
        public static void UpdateStyle(string style_data, string style_str)
        {
            try
            {
                using (FileStream fs = new FileStream(style_path + style_data + ".txt", FileMode.Create))
                {
                    fs.Seek(0, SeekOrigin.Begin);
                    using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
                    {
                        sw.Write(style_str);
                        sw.Flush();
                    }
                }

                List <Model.sys_t_print_style_data> lis = new List <Model.sys_t_print_style_data>();
                lis.Add(new Model.sys_t_print_style_data()
                {
                    style_data = style_data,
                    style_str  = style_str,
                });

                IBLL.IPrint bll = new BLL.PrintBLL();
                bll.UpdateStyleData(lis);
            }
            catch (Exception e)
            {
                MsgForm.ShowFrom(e);
            }
        }
示例#5
0
        private static void LoadStyle()
        {
            try
            {
                IBLL.IPrint bll = new BLL.PrintBLL();
                Dictionary <string, Model.sys_t_print_style_data> dic = bll.GetPrintStyleData("");

                foreach (string key in myStyle.Keys)
                {
                    Model.sys_t_print_style style = myStyle[key];

                    //打印样式  写成文件
                    using (FileStream fs = new FileStream(style_path + style.style_data + ".txt", FileMode.Create))
                    {
                        using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
                        {
                            if (dic.Keys.Contains(style.style_data))
                            {
                                sw.Write(dic[style.style_data].style_str);
                            }
                            else
                            {
                                sw.Write(defaultStyle);
                            }
                            sw.Flush();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MsgForm.ShowFrom(e);
            }
        }
示例#6
0
        public void Request(string t, string pars, out string res)
        {
            WebHelper w = new WebHelper(pars);

            IBLL.IPrint bll = new BLL.PrintBLL();
            try
            {
                w.ReflectionMethod(bll, t);
                res = w.NmJson();
            }
            catch (Exception ex)
            {
                w.WriteError(ex);
                res = w.NmJson();
            }
        }
示例#7
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                IBLL.IPrint bll = new BLL.PrintBLL();
                print_style.is_share    = this.cbShare.Checked ? "1" : "0";
                print_style.is_base     = this.cbIsBase.Checked ? "1" : "0";
                print_style.oper_id     = Program.oper.oper_id;
                print_style.style_name  = this.txtStyleName.Text;
                print_style.update_time = DateTime.Now;

                if (string.IsNullOrEmpty(print_style.style_id))
                {
                    print_style.style_id    = Guid.NewGuid().ToString();
                    print_style.create_time = DateTime.Now;
                    bll.Add(print_style);
                }
                else
                {
                    bll.Update(print_style);
                }

                sys_t_print_style style = PrintHelper.myStyle[print_style.style_id];

                global::PrintHelper.BLL.PrintD  p     = new global::PrintHelper.BLL.PrintD();
                global::PrintHelper.IBLL.IPrint print = p;
                p.SaveStyle += new global::PrintHelper.BLL.PrintD.SaveStyleHandler((style1, xml) =>
                {
                    PrintForm.PrintHelper.UpdateStyle(style1, xml);
                });
                print.Print(style.style_data,
                            PrintForm.PrintHelper.GetStyle(style.style_data),
                            PrintHelper.tb_main,
                            PrintHelper.tb_detail);
                this.Close();
            }
            catch (Exception exception)
            {
                MsgForm.ShowFrom(exception);
            }
        }
示例#8
0
        private void frmPrintAdd_Load(object sender, EventArgs e)
        {
            if (Program.oper.oper_type.Equals("1000"))
            {
                this.cbIsBase.Visible = true;
            }

            if (!string.IsNullOrEmpty(print_style.style_id))
            {
                //修改
                this.txtStyleName.Text = print_style.style_name;
                this.cbShare.Checked   = "1".Equals(print_style.is_share);
                this.cbIsBase.Checked  = "1".Equals(print_style.is_base);
                this.cbStyle.Enabled   = false;
                this.Text = "修改样式";
            }
            else
            {
                IBLL.IPrint bll = new BLL.PrintBLL();
                var         tb  = bll.GetAll(new Model.sys_t_print_style()
                {
                    oper_id   = Program.oper == null ? "" : Program.oper.oper_id,
                    report_id = print_style.report_id,
                });

                if (tb.Columns.Count < 1)
                {
                    tb = Helper.Conv.Assign <Model.sys_t_print_style>();
                }

                var dr = tb.NewRow();
                dr["style_data"] = "";
                dr["style_name"] = "空白";
                tb.Rows.InsertAt(dr, 0);

                this.cbStyle.ValueMember   = "style_data";
                this.cbStyle.DisplayMember = "style_name";
                this.cbStyle.DataSource    = tb;
            }
        }
示例#9
0
 private void btnDefault_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dataGrid1.CurrentRow() == null)
         {
             return;
         }
         IBLL.IPrint bll = new BLL.PrintBLL();
         bll.AddDefault(
             new sys_t_print_style_default()
         {
             oper_id   = Program.oper.oper_id,
             style_id  = this.dataGrid1.CurrentRow()["style_id"].ToString(),
             report_id = print_style.report_id,
         });
     }
     catch (Exception exception)
     {
         MsgForm.ShowFrom(exception);
     }
 }