Ejemplo n.º 1
0
 protected void GrDelete(object sender, CommandEventArgs e)
 {
     int nPageNumber = int.Parse(txtPageNumber.Text);
     int nPageSize = int.Parse(txtPageSize.Text);
     SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];
     nUserLogin.CheckRole("CU0007");
     if (!nUserLogin.Role.Del)
     {
         Response.Write("<script >alert('Bạn không có quyền xóa danh mục này!')</script>");
     }
     else
     {
         try
         {
             int mKey = int.Parse(e.CommandArgument.ToString());
             Harvest_Info info = new Harvest_Info(mKey);
             if ((DateTime.Now - info.DateOn).TotalDays > 7)
             {
                 Response.Write("<script >alert('Dữ liệu đã quá 7 ngày, không được phép xóa!')</script>");
             }
             else
             {
                 info.Delete();
                 DataTable nTable = ForSale_Data.GetList(Convert.ToInt16( Session["EmployeeKey"]), nPageSize, nPageNumber);
                 GV_ForSale.DataSource = nTable;
                 GV_ForSale.DataBind();
                 LoadPages();
             }
         }
         catch
         {
             Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
         }
     }
 }
Ejemplo n.º 2
0
        protected void SaveInfo()
        {
            Harvest_Info info = new Harvest_Info(int.Parse(txtKey.Text));

            info.DateOn      = DateTime.ParseExact(txtDateOn.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            info.SeedsKey    = DDLSeeds.SelectedValue.ToInt();
            info.Code        = txtCode.Text;
            info.WeightBefor = int.Parse(txtWeightBefor.Text);
            info.SlotBefor   = txtSlotBefor.Text;
            info.WeightAfter = int.Parse(txtWeightAfter.Text);
            info.SlotAfter   = txtSlotAfter.Text;
            info.Loss        = txtLoss.Text;
            info.Save();
        }
Ejemplo n.º 3
0
        protected void LoadInfo(int Key)
        {
            Harvest_Info info = new Harvest_Info(Key);

            if (Key == 0)
            {
                DateTime time = DateTime.Now;
                txtDateOn.Text = time.ToString("dd/MM/yyyy");
            }
            else
            {
                txtDateOn.Text = info.DateOn.ToString("dd/MM/yyyy");
            }
            DDLSeeds.SelectedValue = info.SeedsKey.ToString();
            txtCode.Text           = info.Code;
            txtWeightBefor.Text    = info.WeightBefor.ToString();
            txtSlotBefor.Text      = info.SlotBefor;
            txtWeightAfter.Text    = info.WeightAfter.ToString();
            txtSlotAfter.Text      = info.SlotAfter;
            txtLoss.Text           = info.Loss;
        }
Ejemplo n.º 4
0
 protected void GrDelete(object sender, CommandEventArgs e)
 {
     try
     {
         int          mKey = int.Parse(e.CommandArgument.ToString());
         Harvest_Info info = new Harvest_Info(mKey);
         if ((DateTime.Now - info.DateOn).TotalDays > 7)
         {
             Response.Write("<script >alert('Dữ liệu đã quá 7 ngày, không được phép xóa!')</script>");
         }
         else
         {
             info.Delete();
             DataTable nTable = Accident_Data.GetList();
             GV_Accident.DataSource = nTable;
             GV_Accident.DataBind();
         }
     }
     catch
     {
         Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
     }
 }