Пример #1
0
 private void ShowInfo(int id)
 {
     Maticsoft.BLL.account   bll   = new Maticsoft.BLL.account();
     Maticsoft.Model.account model = bll.GetModel(id);
     this.lblid.Text      = model.id.ToString();
     this.lblname.Text    = model.name;
     this.lblleibei.Text  = model.leibei;
     this.lbllururen.Text = model.lururen;
     this.lbltime.Text    = model.time.ToString();
     if (model.peixunban_id != 0)
     {
         Maticsoft.BLL.peixunban1   pei_bll = new BLL.peixunban1();
         Maticsoft.Model.peixunban1 pei_mol = new Model.peixunban1();
         pei_mol = pei_bll.GetModel(Convert.ToInt16(model.peixunban_id));
         this.lblpeixunban_id.Text = pei_mol.name;
     }
     this.lblbeizhu.Text = model.beizhu;
 }
        protected void submit_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsDateTime(start_time.Text))
            {
                strErr += "开始时间格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(end_time.Text))
            {
                strErr += "结束时间格式错误!\\n";
            }
            if (this.peixunban_name.Text.Trim().Length == 0)
            {
                strErr += "培训班名称不能为空!\\n";
            }
            if (this.contact_per.Text.Trim().Length == 0)
            {
                strErr += "联系人不能为空!\\n";
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            Maticsoft.Model.peixunban1 pxb = new Model.peixunban1();
            pxb.name       = peixunban_name.Text.Trim();
            pxb.contact    = contact_per.Text.Trim();
            pxb.phone      = phone.Text.Trim();
            pxb.start_time = DateTime.Parse(start_time.Text);
            pxb.end_time   = DateTime.Parse(end_time.Text);
            pxb.sinal      = 2;
            pxb.beizhu     = num.Text;

            Maticsoft.BLL.peixunban1 pxb_bll = new BLL.peixunban1();
            int id = pxb_bll.Add(pxb);

            pxb.id = id;
            Session["peixunban"] = pxb;
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "branch_add2.aspx");
        }