コード例 #1
0
        protected void SaveInfo()
        {
            Pesticide_Info info = new Pesticide_Info(int.Parse(txtKey.Text));

            info.Trade_Name  = txtTradeName.Text;
            info.Crop_Name   = txtCropName.Text;
            info.Common_Key  = int.Parse(DLLCommon.SelectedValue);
            info.CompanyKey  = int.Parse(DLLCompany.SelectedValue);
            info.UsingStatus = int.Parse(rdbStatus.SelectedValue);
            info.CategoryKey = 1;
            if (FileUploadKML.HasFile)
            {
                try
                {
                    FileUploadKML.SaveAs(Server.MapPath("~/Img/Pesticides/") + info.PesticideKey.ToString() + ".png");
                    info.Images = "../Img/Pesticides/" + info.PesticideKey.ToString() + ".png";
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                info.Images = "../Img/Pesticides/Default.png";
            }
            info.Save();
        }
コード例 #2
0
ファイル: Pesticide.aspx.cs プロジェクト: DHLONGAN/VietGAP
        protected void GrDelete(object sender, CommandEventArgs e)
        {
            SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];

            nUserLogin.CheckRole("CA0003");
            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());
                    Pesticide_Info info = new Pesticide_Info(mKey);
                    info.Delete();
                    DataTable nTable = Pesticides_Data.GetList(0, 1, txtSearch.Text);
                    GV_Pesticides.DataSource = nTable;
                    GV_Pesticides.DataBind();
                }
                catch
                {
                    Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
                }
            }
        }
コード例 #3
0
        protected void LoadInfo(int Key)
        {
            Pesticide_Info info = new Pesticide_Info(Key);

            txtTradeName.Text = info.Trade_Name;
            txtCropName.Text  = info.Crop_Name;
            if (Key == 0)
            {
                DLLCommon.SelectedValue  = "108";
                DLLCompany.SelectedValue = "234";
            }
            else
            {
                DLLCommon.SelectedValue  = info.Common_Key.ToString();
                DLLCompany.SelectedValue = info.CompanyKey.ToString();
            }
            rdbStatus.SelectedValue = info.UsingStatus.ToString();
            imgLink.ImageUrl        = info.Images;
        }