protected void btnSaveThuoc_Click(object sender, EventArgs e)
        {
            int res;

            if (ddlThuoc.SelectedValue == "0")
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "chuacovattu", "alert('Chưa chọn thuốc');", true);
                return;
            }
            if (ddlLoaiCa.SelectedValue == "0")
            {
                string ress = csCont.CaSauAn_InsertUpdateThuoc_SS(int.Parse(hdCaSauAn.Value), int.Parse(ddlThuoc.SelectedValue), decimal.Parse(txtKhoiLuong.Text), UserId);
                if (ress == "")
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "daluuxong", "alert('Đã thêm thành công');", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "daluuxong", "alert('Một số loại cá không cho thuốc được:" + ress + "');", true);
                }
                LoadThuoc();
                return;
            }
            string  StrPhanCachKhuChuong = "";
            string  khuchuong            = "";
            string  currkhuchuong        = "";
            string  StrSoLuongChuong     = "";
            string  StrSoLuongChuongTT   = "";
            string  StrChuong            = "";
            string  StrKL = "";
            decimal testKL;
            int     SoLuongCa = 0;
            int     SoLuongTT = 0;
            int     index     = 0;

            foreach (GridViewRow r in grvDanhSach.Rows)
            {
                TextBox txtKL      = (TextBox)(r.FindControl("txtKhoiLuong"));
                Label   lblSoLuong = (Label)(r.FindControl("lblSoLuong"));
                Label   lblSLTT    = (Label)(r.FindControl("lblSLTT"));
                Label   lblChuong  = (Label)(r.FindControl("lblChuong"));
                testKL = -1;
                if (Decimal.TryParse(txtKL.Text, out testKL) && testKL > 0)
                {
                    StrSoLuongChuong   += "@" + lblSoLuong.Text + "@";
                    StrSoLuongChuongTT += "@" + lblSLTT.Text + "@";
                    StrChuong          += "@" + lblChuong.ToolTip + "@";
                    StrKL        += "@" + txtKL.Text.Replace(",", ".") + "@";
                    SoLuongCa    += int.Parse(lblSoLuong.Text);
                    SoLuongTT    += int.Parse(lblSLTT.Text);
                    currkhuchuong = lblChuong.Text.Substring(0, 2);
                    if (currkhuchuong != khuchuong)
                    {
                        StrPhanCachKhuChuong += "@" + index + "@";
                        khuchuong             = currkhuchuong;
                    }
                    index++;
                }
            }
            if (StrPhanCachKhuChuong != "")
            {
                StrPhanCachKhuChuong = StrPhanCachKhuChuong.Substring(3) + "@" + index.ToString() + "@";
            }
            res = csCont.CaSauAn_InsertUpdateThuoc(int.Parse(hdCaSauAn.Value), int.Parse(ddlThuoc.SelectedValue), decimal.Parse(txtKhoiLuong.Text), int.Parse(ddlLoaiCa.SelectedValue), SoLuongCa, SoLuongTT, StrSoLuongChuong, StrSoLuongChuongTT, StrChuong, StrKL, StrPhanCachKhuChuong, UserId, true);
            if (res == 0)
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "daluuxong", "alert('Lưu không thành công! Có thể thời điểm cho ăn hoặc khối lượng thuốc không hợp lệ');", true);
            }
            else
            {
                LoadThuoc();
            }
        }