Exemplo n.º 1
0
 protected void btnsave_DirectClick(object sender, EventArgs e)
 {
     try
     {
         Plan        rpt    = new Plan();
         PlanService rptbso = new PlanService();
         if (PlanId < 1)
         {
             rpt.CreateByUser = m_UserValidation.UserId;
             rpt.CreateDate   = DateTime.Now;
             rpt.Des          = txtmota.Text;
             rpt.EnterpriseId = m_UserValidation.OrgId;
             rpt.ModifyByUser = 0;
             rpt.ModifyDate   = DateTime.Now;
             IFormatProvider culture = new System.Globalization.CultureInfo("en-US", true);
             rpt.ReportId   = ReportId;
             rpt.ReportDate = DateTime.ParseExact(txtNgaytao.Text, @"dd/MM/yyyy", culture);
             //rpt.BeginDate = DateTime.ParseExact(txFromYear.Text, @"dd/MM/yyyy", culture);
             //rpt.EndDate = DateTime.ParseExact(txtEndYear.Text, @"dd/MM/yyyy", culture);
             int i = rptbso.Insert(rpt);
             if (i > 0)
             {
                 PlanId          = i;
                 clientview.Text = "<div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Cập nhật thành công !</div>";
                 //BindPlanTKNL();
             }
             else
             {
                 clientview.Text = "div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Cập nhật thất bại !</div>";
             }
         }
         else
         {
             rpt = rptbso.FindByKey(PlanId);
             rpt.ModifyByUser = m_UserValidation.UserId;
             rpt.ModifyDate   = DateTime.Now;
             IFormatProvider culture = new System.Globalization.CultureInfo("en-US", true);
             // rpt.ReportDate = DateTime.ParseExact(txtNgaytao.Text, "dd/MM/yyyy", culture);
             ///rpt.PlanName = txttieude.Text;
             rpt.Des = txtmota.Text;
             //rpt.EnterpriseId = Convert.ToInt32(memVal.OrgId);
             rpt.ReportDate = DateTime.ParseExact(txtNgaytao.Text, @"dd/MM/yyyy", culture);
             //rpt.BeginYear= DateTime.ParseExact(txFromYear.Text, @"dd/MM/yyyy", culture);
             //rpt.EndYear = DateTime.ParseExact(txtEndYear.Text, @"dd/MM/yyyy", culture);
             int i = rptbso.Update(rpt);
             if (i > 0)
             {
                 //ltDes.Text = rpt.Des;
                 clientview.Text = "<div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Cập nhật thành công !</div>";
                 //BindPlanTKNL();
             }
             else
             {
                 clientview.Text = "div style='color:#ff0000;font:bold 12px Arial;padding:5px 0;'>Cập nhật thất bại !</div>";
             }
         }
     }
     catch (Exception ex)
     { }
 }