예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dt = Accident_Data.GetAddressList();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PlaceOfBuy += "\"" + dt.Rows[i]["PlaceOfBuy"].ToString() + "\",";
            }
            string nKey = this.Request["key"];

            txtKey.Text = "0";
            int _nKey = 0;

            if (nKey != null)
            {
                if (int.TryParse(nKey, out _nKey))
                {
                    txtKey.Text = nKey;
                }
                if (!IsPostBack)
                {
                    LoadInfo(_nKey);
                    LoadDataToToolboxWeb.DropDown_DDL(DDLSeeds, "SELECT SeedsKey,SeedsName FROM PUL_Seeds", false);
                    LoadDataToToolboxWeb.DropDown_DDL(DDLEquipment, "SELECT EquipmentKey,EquipmentName FROM PUL_Equipment", false);
                    LoadDataToToolboxWeb.DropDown_DDL(DDLCooperative, "SELECT EquipmentKey,EquipmentName FROM PUL_Equipment", false);
                }
            }
        }
예제 #2
0
        protected void OnPaging(object sender, GridViewPageEventArgs e)
        {
            GV_Accident.PageIndex = e.NewPageIndex;
            DataTable nTable = Accident_Data.GetList();

            GV_Accident.DataSource = nTable;
            GV_Accident.DataBind();
        }
예제 #3
0
        protected void cmdView_Click1(object sender, ImageClickEventArgs e)
        {
            DateTime  dtfrom = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime  dtto   = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DataTable nTable = Accident_Data.GetList(dtfrom, dtto);

            GV_Accident.DataSource = nTable;
            GV_Accident.DataBind();
        }
예제 #4
0
        public void LoadData()
        {
            DataTable nTable = Accident_Data.GetList();

            GV_Accident.DataSource = nTable;
            GV_Accident.DataBind();
            DateTime dt = DateTime.Now;

            txtfromDatetime.Text = "01/01/2013";
            txttoDatetime.Text   = DateTime.Now.ToString("dd/MM/yyyy");
        }
예제 #5
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>");
     }
 }