예제 #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("CA0007");
            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());
                    Seed_Cooperative_Info info = new Seed_Cooperative_Info(mKey);
                    info.Delete();
                    DataTable nTable = Seed_Cooperative_Data.GetList(nPageSize, nPageNumber, txtSearch.Text, int.Parse(Session["CooperativeKey"].ToString()));
                    GV_Seed_Cooperative.DataSource = nTable;
                    GV_Seed_Cooperative.DataBind();
                    LoadPages();
                }
                catch
                {
                    Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
                }
            }
        }
예제 #2
0
        public static List <string[]> GetLoadSeedCooperative()
        {
            DataTable       nTable = Seed_Cooperative_Info.GetListSeed();
            List <string[]> li_str = ConvertTableToSting(nTable);

            return(li_str);
        }
예제 #3
0
        public static List <string[]> GetLoadSeedCooperativePriceTypeKey(int TypeKey)
        {
            DataTable       nTable = Seed_Cooperative_Info.GetListSeedPrice(TypeKey);
            List <string[]> li_str = ConvertTableToSting(nTable);

            return(li_str);
        }
예제 #4
0
        protected void LoadInfo(int Key)
        {
            Seed_Cooperative_Info info = new Seed_Cooperative_Info(Key);

            DLLSeeds.SelectedValue = info.SeedKey.ToString();
            txtPrice.Text          = String.Format("{0:#,0}", info.Price);
        }
예제 #5
0
        public static List <string[]> GetLoadSeedCooperativeTypeKey(int TypeKey)
        {
            //int test = Convert.ToInt32(TypeKey);
            DataTable       nTable = Seed_Cooperative_Info.GetListSeed(TypeKey);
            List <string[]> li_str = ConvertTableToSting(nTable);

            return(li_str);
        }
예제 #6
0
        protected string LoadSeedCooperative(string id)
        {
            DataTable nTable    = Seed_Cooperative_Info.GetListSeed();
            string    LSeedCoop = "";

            for (int i = 0; i < nTable.Rows.Count; i++)
            {
                LSeedCoop += "{SeedsKey:'" + nTable.Rows[i]["SeedsKey"] + "',SeedsName:'" + nTable.Rows[i]["SeedsName"] + "',Cooperative_Name:'" + nTable.Rows[i]["Cooperative_Name"] + "',Cooperative_Key:'" + nTable.Rows[i]["Cooperative_Key"] + "',Images:'" + nTable.Rows[i]["Images"].ToString().Substring(3) + "',Phone:'" + nTable.Rows[i]["Phone"] + "',Address:'" + nTable.Rows[i]["Address"] + "',VietGAPCode:'" + nTable.Rows[i]["VietGAPCode"] + "'},";
            }
            return(LSeedCoop);
        }
예제 #7
0
        protected void SaveInfo()
        {
            Seed_Cooperative_Info info = new Seed_Cooperative_Info(int.Parse(txtKey.Text));

            info.SeedKey        = int.Parse(DLLSeeds.SelectedValue);
            info.CooperativeKey = Convert.ToInt16(Session["CooperativeKey"]);
            info.Price          = txtPrice.Text.Tofloat();
            SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];

            if (txtKey.Text.ToInt() == 0)
            {
                info.CreatedBy       = info.ModifiedBy = new Guid(nUserLogin.Key);
                info.CreatedDateTime = info.ModifiedDateTime = DateTime.Now;
            }
            else
            {
                info.ModifiedBy       = new Guid(nUserLogin.Key);
                info.ModifiedDateTime = DateTime.Now;
            }
            info.Save();
        }