Ejemplo n.º 1
0
        public static DataTable GetMainTable(string WhereClause, string sortBy, int startIndex, int pageSize)
        {
            CaSauController csCont = new CaSauController();
            DataTable       result = csCont.LoadPageCaSauMainTable(WhereClause, GetStandardSQLOrder(sortBy), startIndex, pageSize);

            return(result);
        }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         CaSauController csCont = new CaSauController();
         int             result;
         int             idkhayap = 0;
         if (Request.QueryString["khayapid"] != null)
         {
             result = csCont.UpdateKhayAp(int.Parse(Request.QueryString["khayapid"]), txtKhayAp.Text, chkActive.Checked);
         }
         else
         {
             result = csCont.InsertKhayAp(txtKhayAp.Text, out idkhayap);
         }
         if (result == -1)
         {
             Page.ClientScript.RegisterStartupScript(typeof(string), "updatefail", "alert('Cập nhật không thành công');", true);
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(typeof(string), "updatesuccess", "alert('Cập nhật thành công!');", true);
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 3
0
        public static DataTable GetVatTu(string LVT, string sortBy)
        {
            CaSauController csCont = new CaSauController();
            DataTable       result = csCont.LoadVatTu_HienTai(LVT, GetStandardSQLOrder(sortBy));

            return(result);
        }
Ejemplo n.º 4
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         CaSauController csCont = new CaSauController();
         int             result;
         int             idchuong = 0;
         int?            So       = null;
         if (txtSo.Text != "")
         {
             So = int.Parse(txtSo.Text);
         }
         if (Request.QueryString["chuongid"] != null)
         {
             result = csCont.UpdateChuong(int.Parse(Request.QueryString["chuongid"]), txtChuong.Text, chkActive.Checked, txtTenChuong.Text, So);
         }
         else
         {
             result = csCont.InsertChuong(txtChuong.Text, txtTenChuong.Text, So, out idchuong);
         }
         if (result == -1)
         {
             Page.ClientScript.RegisterStartupScript(typeof(string), "updatefail", "alert('Cập nhật không thành công');", true);
             return;
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(typeof(string), "updatesuccess", "alert('Cập nhật thành công!');", true);
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 5
0
        public static int Count(string WhereClause, string Date)
        {
            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("vi-VN");
            DateTime        dDate  = DateTime.Parse(Date, ci);
            CaSauController csCont = new CaSauController();

            return(csCont.CountCaSau(WhereClause, dDate));
        }
Ejemplo n.º 6
0
        public static DataTable Get(string WhereClause, string sortBy, int startIndex, int pageSize, string Date)
        {
            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("vi-VN");
            DateTime        dDate  = DateTime.Parse(Date, ci);
            CaSauController csCont = new CaSauController();
            DataTable       result = csCont.LoadPageCaSau(WhereClause, GetStandardSQLOrder(sortBy), startIndex, pageSize, dDate);

            return(result);
        }
Ejemplo n.º 7
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         CaSauController csCont = new CaSauController();
         if (Request.QueryString["namcan"] != null)
         {
             csCont.KhoiLuongCuoiKy_Delete(int.Parse(Request.QueryString["namcan"]));
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 8
0
        protected void btnMoKhoa_Click(object sender, EventArgs e)
        {
            CaSauController cont = new CaSauController();
            string          l    = "";

            foreach (ListItem i in lstLoaiDuLieu.Items)
            {
                if (i.Selected)
                {
                    l += "@" + i.Value + "@";
                }
            }
            if (l != "")
            {
                cont.UnLock(l);
            }
            Page.ClientScript.RegisterStartupScript(typeof(string), "mokhoasuccess", "alert('Đã mở khóa!');", true);
        }
Ejemplo n.º 9
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         CaSauController csCont = new CaSauController();
         if (Request.QueryString["namcan"] != null)
         {
             csCont.UpdateKhoiLuongCuoiKy(int.Parse(txtNamCan.Text), decimal.Parse(txtSoSinh.Text), decimal.Parse(txtCuoiKyUm_Giong.Text), decimal.Parse(txtCuoiKyUm_TT.Text), decimal.Parse(txtCuoiKyUm.Text), decimal.Parse(txtCuoiKy1Nam_Giong.Text), decimal.Parse(txtCuoiKy1Nam_TT.Text), decimal.Parse(txtCuoiKy1Nam.Text), decimal.Parse(txtCuoiKyST1_Giong.Text), decimal.Parse(txtCuoiKyST1_TT.Text), decimal.Parse(txtCuoiKyST1.Text), decimal.Parse(txtCuoiKyST2_Giong.Text), decimal.Parse(txtCuoiKyST2_TT.Text), decimal.Parse(txtCuoiKyST2.Text), decimal.Parse(txtCuoiKyHB1_Giong.Text), decimal.Parse(txtCuoiKyHB1_TT.Text), decimal.Parse(txtCuoiKyHB1.Text), decimal.Parse(txtCuoiKyHB2_Giong.Text), decimal.Parse(txtCuoiKyHB2_TT.Text), decimal.Parse(txtCuoiKyHB2.Text));
         }
         else
         {
             csCont.InsertKhoiLuongCuoiKy(int.Parse(txtNamCan.Text), decimal.Parse(txtSoSinh.Text), decimal.Parse(txtCuoiKyUm_Giong.Text), decimal.Parse(txtCuoiKyUm_TT.Text), decimal.Parse(txtCuoiKyUm.Text), decimal.Parse(txtCuoiKy1Nam_Giong.Text), decimal.Parse(txtCuoiKy1Nam_TT.Text), decimal.Parse(txtCuoiKy1Nam.Text), decimal.Parse(txtCuoiKyST1_Giong.Text), decimal.Parse(txtCuoiKyST1_TT.Text), decimal.Parse(txtCuoiKyST1.Text), decimal.Parse(txtCuoiKyST2_Giong.Text), decimal.Parse(txtCuoiKyST2_TT.Text), decimal.Parse(txtCuoiKyST2.Text), decimal.Parse(txtCuoiKyHB1_Giong.Text), decimal.Parse(txtCuoiKyHB1_TT.Text), decimal.Parse(txtCuoiKyHB1.Text), decimal.Parse(txtCuoiKyHB2_Giong.Text), decimal.Parse(txtCuoiKyHB2_TT.Text), decimal.Parse(txtCuoiKyHB2.Text));
         }
         Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, ""));
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         CaSauController csCont = new CaSauController();
         int             result;
         int             idlydochet = 0;
         if (Request.QueryString["lydochetid"] != null)
         {
             csCont.UpdateLyDoChet(int.Parse(Request.QueryString["lydochetid"]), txtLyDo.Text, "", chkActive.Checked, "");
         }
         else
         {
             csCont.InsertLyDoChet(txtLyDo.Text, "", true, "", out idlydochet);
         }
         Page.ClientScript.RegisterStartupScript(typeof(string), "updatesuccess", "alert('Cập nhật thành công!');", true);
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 11
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         CaSauController csCont = new CaSauController();
         int             result;
         int             idnhacungcap = 0;
         if (Request.QueryString["nhacungcapid"] != null)
         {
             csCont.UpdateNhaCungCap(int.Parse(Request.QueryString["nhacungcapid"]), txtNhaCungCap.Text, txtLoaiVatTu.Text, chkActive.Checked, 0);
         }
         else
         {
             csCont.InsertNhaCungCap(txtNhaCungCap.Text, txtLoaiVatTu.Text, true, 0, out idnhacungcap);
         }
         Page.ClientScript.RegisterStartupScript(typeof(string), "updatesuccess", "alert('Cập nhật thành công!');", true);
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 12
0
        protected void btnKhoaSo_Click(object sender, EventArgs e)
        {
            try
            {
                System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("vi-VN");
                CaSauController cont   = new CaSauController();
                int             result = cont.Config_SetNgayKhoaSo(DateTime.Parse(txtDate.Text.Trim(), ci));
                if (result == -1)
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "khoasofail", "alert('Khóa sổ không thành công');", true);
                    return;
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(typeof(string), "khoasosuccess", "alert('Khóa sổ thành công!');", true);
                }
            }

            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Ejemplo n.º 13
0
        private void BindControls()
        {
            CaSauController csCont    = new CaSauController();
            DataTable       tblLoaiCa = new DataTable();

            tblLoaiCa                = csCont.LoadLoaiCa(1);
            ddlLoaiCa.DataSource     = tblLoaiCa;
            ddlLoaiCa.DataTextField  = "TenLoaiCa";
            ddlLoaiCa.DataValueField = "IDLoaiCa";
            ddlLoaiCa.DataBind();

            DataTable tblNguonGoc = new DataTable();

            tblNguonGoc                = csCont.LoadNguonGoc(1);
            ddlNguonGoc.DataSource     = tblNguonGoc;
            ddlNguonGoc.DataTextField  = "TenNguonGoc";
            ddlNguonGoc.DataValueField = "IDNguonGoc";
            ddlNguonGoc.DataBind();

            DataTable tblChuong = new DataTable();

            tblChuong                = csCont.LoadChuong(1);
            ddlChuong.DataSource     = tblChuong;
            ddlChuong.DataTextField  = "Chuong";
            ddlChuong.DataValueField = "IDChuong";
            ddlChuong.DataBind();

            DataTable tblCaMe = new DataTable();

            tblCaMe                = csCont.LoadCaSauMe_AllTrangThai();
            ddlCaMe.DataSource     = tblCaMe;
            ddlCaMe.DataTextField  = "CaMe";
            ddlCaMe.DataValueField = "IDCaSau";
            ddlCaMe.DataBind();
            ddlCaMe.Items.Insert(0, new ListItem("", "0"));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString() == "vi-VN")
                {
                    thapphan = ",";
                }
                else
                {
                    thapphan = ".";
                }
                scale   = int.Parse(ConfigurationManager.AppSettings["QLCS_VatTu_TTY_Scale"]);
                scaleCT = scale;
                Page.ClientScript.RegisterClientScriptInclude("jquery", ResolveUrl("~/js/impromptu/jquery.js"));
                if (!Page.IsPostBack)
                {
                    lnkCancel.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "mid/" + this.ModuleId.ToString());
                    if (Request.QueryString["csaid"] != null)
                    {
                        hdCaSauAn.Value = Request.QueryString["csaid"];
                    }
                    if (hdCaSauAn.Value == "")
                    {
                        tblThuocChuong.Visible = false;
                        BindCaSauAnControls();
                    }
                    else
                    {
                        tblThuocChuong.Visible = true;
                        BindCaSauAnControls();
                        LoadCaSauAn(int.Parse(hdCaSauAn.Value));
                        BindThuocControls_Edit();
                        LoadThuoc();
                    }
                }

                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    btnSaveCaSauAn.Visible = false;
                    btnSaveThuoc.Visible   = false;
                    pnlCommand.Visible     = false;
                    lnkThuocMulti.Visible  = false;
                }
                else
                {
                    if (ddlRowStatus.SelectedValue == "0")
                    {
                        pnlCommand.Visible = false;
                    }
                    else
                    {
                        pnlCommand.Visible = true;
                    }
                }

                if (hdCaSauAn.Value != "")
                {
                    lnkThucAn.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "casauan_edit_thucan", "csaid/" + hdCaSauAn.Value, "mid/" + this.ModuleId.ToString());
                    DotNetNuke.Entities.Tabs.TabController t = new DotNetNuke.Entities.Tabs.TabController();
                    int ThuocMultiPage = t.GetTabByName(ConfigurationManager.AppSettings["QLCS_CaSauAnThuocMulti"], PortalId).TabID;
                    lnkThuocMulti.Attributes["onclick"] = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(ThuocMultiPage, "", "csaid/" + hdCaSauAn.Value) + "','CaSauAn',900,600);";
                    //lnkThuocMulti.Attributes["onclick"] = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "casauan_thuoc_multi", "csaid/" + hdCaSauAn.Value, "mid/" + this.ModuleId.ToString()) + "','CaSauAn',900,600);";
                }
                if (ddlLoaiCa.SelectedValue == "1")
                {
                    scaleCT = scaleCT + 2;
                }
                lnkPhanBoThuoc.Attributes["onclick"] = "phanbothuoc();";
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                btnSaveCaSauAn.Visible = false;
                btnSaveThuoc.Visible   = false;
            }
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString["csaid"] == null)
                {
                    btnSaveThucAn.Visible = false;
                    return;
                }
                hdLoaiCaNhanVienKhuChuong.Value = ConfigurationManager.AppSettings["QLCS_LoaiCaNhanVienKhuChuong"];
                if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString() == "vi-VN")
                {
                    thapphan = ",";
                }
                else
                {
                    thapphan = ".";
                }
                scale   = int.Parse(ConfigurationManager.AppSettings["QLCS_VatTu_TA_Scale"]);
                scaleCT = scale;
                Page.ClientScript.RegisterClientScriptInclude("jquery", ResolveUrl("~/js/impromptu/jquery.js"));
                if (!Page.IsPostBack)
                {
                    hdCaSauAn.Value = Request.QueryString["csaid"];
                    DataTable tbl = csCont.CaSauAn_GetByID(int.Parse(hdCaSauAn.Value));
                    tblThucAnChuong.Visible = true;
                    if (tbl.Rows.Count == 1)
                    {
                        BindThucAnControls(Convert.ToDateTime(tbl.Rows[0]["ThoiDiem"]));
                    }
                    ddlLoaiCa_SelectedIndexChanged(null, null);
                    Page.ClientScript.RegisterStartupScript(typeof(string), "loadcakhoidong", "loaica_change('" + ddlLoaiCa.SelectedValue + "');", true);
                }

                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    btnSaveThucAn.Visible = false;
                    pnlCommand.Visible    = false;
                    lnkAdd.Visible        = false;
                    lnkDelete.Visible     = false;
                    ddlNhanVien.Visible   = false;
                    ddlKhuChuong.Visible  = false;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                btnSaveThucAn.Visible = false;
            }
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    DataTable dtChuong = csCont.LoadChuong(1);
                    ddlChuong.DataSource     = dtChuong;
                    ddlChuong.DataTextField  = "Chuong";
                    ddlChuong.DataValueField = "IDChuong";
                    ddlChuong.DataBind();
                    ddlChuong.Items.Insert(0, new ListItem("Chung", "-1"));
                    ddlChuong.Items.Insert(0, new ListItem("", "0"));

                    lnkAddNote.NavigateUrl     = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "note_edit", "mid/" + this.ModuleId.ToString());
                    lnkMultiChuong.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "note_multichuong", "mid/" + this.ModuleId.ToString());

                    if (Session["AutoDisplay_Note"] != null && Convert.ToBoolean(Session["AutoDisplay_Note"]))
                    {
                        txtNgayTo.Text             = Session["Note_NgayDen"].ToString();
                        txtNgayFrom.Text           = Session["Note_NgayTu"].ToString();
                        ddlRowStatus.SelectedValue = Session["Note_RowStatus"].ToString();
                        Config.SetSelectedValues(ddlChuong, Session["Note_Chuong"].ToString());
                        btnLoad_Click(null, null);
                    }
                }
                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    lnkAddNote.Visible = false;
                }
                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "KhoaCS"))
                {
                    btnKhoa.Visible   = false;
                    btnMoKhoa.Visible = false;
                    grvDanhSach.Columns[3].Visible = false;
                }
                else
                {
                    if (lblTongSo.Text == "")
                    {
                        btnKhoa.Visible   = false;
                        btnMoKhoa.Visible = false;
                        grvDanhSach.Columns[3].Visible = false;
                    }
                    else
                    {
                        btnKhoa.Visible   = true;
                        btnMoKhoa.Visible = true;
                        grvDanhSach.Columns[3].Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        protected void grvDanhSach_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lblSTT = (Label)(e.Row.FindControl("lblSTT"));
                int   t      = e.Row.RowIndex + 1;
                lblSTT.Text = t.ToString();
                DataRow           r          = ((DataRowView)e.Row.DataItem).Row;
                HtmlInputCheckBox chkChon    = (HtmlInputCheckBox)(e.Row.FindControl("chkChon"));
                TextBox           txtKL      = (TextBox)(e.Row.FindControl("txtKhoiLuong"));
                Label             lblSoLuong = (Label)(e.Row.FindControl("lblSoLuong"));
                int SoLuongCa = Convert.ToInt32(r["SoLuong"]);
                lblSoLuong.Text = r["SoLuong"].ToString();
                Label lblChuong = (Label)(e.Row.FindControl("lblChuong"));
                lblChuong.Text    = r["Chuong"].ToString();
                lblChuong.ToolTip = r["IDChuong"].ToString();

                Label lblSLTT = (Label)(e.Row.FindControl("lblSLTT"));
                int   SLTT    = Convert.ToInt32(r["SoLuongTT"]);
                lblSLTT.Text = Config.ToXVal2(SLTT, 0);
                Label lblSLG = (Label)(e.Row.FindControl("lblSLG"));
                int   SLG    = SoLuongCa - SLTT;
                lblSLG.Text = Config.ToXVal2(SLG, 0);

                chkChon.Attributes["onclick"] = "chon_click(event, this);";
                if (r["KhoiLuong"] != DBNull.Value && Convert.ToDecimal(r["KhoiLuong"]) != 0)
                {
                    //txtKL.Text = Config.ToXVal2(r["KhoiLuong"], ChuongScale);
                    txtKL.Text = Convert.ToDecimal(r["KhoiLuong"]).ToString("0.#####");
                }

                Label   lblKLTT   = (Label)(e.Row.FindControl("lblKLTT"));
                decimal KhoiLuong = decimal.Parse(txtKL.Text);
                decimal KLTT      = KhoiLuong * SLTT / SoLuongCa;
                lblKLTT.Text = Config.ToXVal2(KLTT, ChuongScale);
                if (decimal.Parse(lblKLTT.Text) == 0)
                {
                    lblKLTT.Text = Config.ToXVal2(KLTT, ChuongScale + 1);
                }
                if (decimal.Parse(lblKLTT.Text) == 0)
                {
                    lblKLTT.Text = "0";
                }
                Label   lblKLG = (Label)(e.Row.FindControl("lblKLG"));
                decimal KLG    = KhoiLuong - KLTT;
                lblKLG.Text = Config.ToXVal2(KLG, ChuongScale);
                if (decimal.Parse(lblKLG.Text) == 0)
                {
                    lblKLG.Text = Config.ToXVal2(KLG, ChuongScale + 1);
                }
                if (decimal.Parse(lblKLG.Text) == 0)
                {
                    lblKLG.Text = "0";
                }
                Label   lblTrungBinh = (Label)(e.Row.FindControl("lblTrungBinh"));
                decimal TrungBinh    = KhoiLuong / SoLuongCa;
                lblTrungBinh.Text = Config.ToXVal2(TrungBinh, ChuongScale + 1);
                if (decimal.Parse(lblTrungBinh.Text) == 0)
                {
                    lblTrungBinh.Text = Config.ToXVal2(TrungBinh, ChuongScale + 2);
                }

                HyperLink lnkDelKhoiLuong = (HyperLink)(e.Row.FindControl("lnkDelKhoiLuong"));
                lnkDelKhoiLuong.Attributes["onclick"] = "setVal('" + lnkDelKhoiLuong.ClientID + "',0);";
                lnkDelKhoiLuong.Attributes["style"]   = "cursor:pointer;";

                TextBox txtGhiChu     = (TextBox)(e.Row.FindControl("txtGhiChu"));
                Button  btnSaveGhiChu = (Button)(e.Row.FindControl("btnSaveGhiChu"));
                txtGhiChu.Text                = r["Note"].ToString();
                btnSaveGhiChu.Visible         = true;
                btnSaveGhiChu.CommandArgument = e.Row.RowIndex.ToString() + ";" + r["IDChuong"].ToString();
                if ((r["Lock"] != DBNull.Value && Convert.ToBoolean(r["Lock"]) == true) || ddlRowStatus.SelectedValue == "0")
                {
                    btnSaveGhiChu.Visible = false;
                }
                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    btnSaveGhiChu.Visible   = false;
                    lnkDelKhoiLuong.Visible = false;
                }
                //if (KhoiLuong != 0)
                //{
                cTongKhoiLuong += KhoiLuong;
                cTongKLTT      += decimal.Parse(lblKLTT.Text);
                cTongSoLuong   += SoLuongCa;
                cTongSLTT      += SLTT;
                //}
            }
            else if (e.Row.RowType == DataControlRowType.Footer)
            {
                TextBox txtTongKhoiLuong = (TextBox)(e.Row.FindControl("txtTongKhoiLuong"));
                Label   lblTongKLTT      = (Label)(e.Row.FindControl("lblTongKLTT"));
                Label   lblTongKLG       = (Label)(e.Row.FindControl("lblTongKLG"));
                Label   lblTongSoLuong   = (Label)(e.Row.FindControl("lblTongSoLuong"));
                Label   lblTongSLTT      = (Label)(e.Row.FindControl("lblTongSLTT"));
                Label   lblTongSLG       = (Label)(e.Row.FindControl("lblTongSLG"));
                txtTongKhoiLuong.Text = Config.ToXVal2(cTongKhoiLuong, ChuongScale);
                lblTongKLTT.Text      = Config.ToXVal2(cTongKLTT, ChuongScale);
                lblTongKLG.Text       = Config.ToXVal2(cTongKhoiLuong - cTongKLTT, ChuongScale);
                lblTongSoLuong.Text   = Config.ToXVal2(cTongSoLuong, 0);
                lblTongSLTT.Text      = Config.ToXVal2(cTongSLTT, 0);
                lblTongSLG.Text       = Config.ToXVal2(cTongSoLuong - cTongSLTT, 0);
            }
        }
Ejemplo n.º 18
0
 protected void LoadData()
 {
     if (lblGMC.Text != "0")
     {
         DataTable tblGMC = csCont.GietMoCa_GetByID(int.Parse(lblGMC.Text));
         if (Convert.ToDateTime(tblGMC.Rows[0]["NgayMo"]) < Config.NgayKhoaSo())
         {
             //btnAddGietMoCaChiTiet.Visible = false;
             btnAddGietMoCaChiTiet.Enabled  = false;
             btnAddGietMoCaChiTiet.CssClass = "buttondisable";
             afterKhoaSo = false;
         }
         else
         {
             afterKhoaSo = true;
             if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
             {
                 btnAddGietMoCaChiTiet.Visible = false;
                 isAdmin = false;
             }
             else
             {
                 if (Convert.ToBoolean(tblGMC.Rows[0]["Lock"]))
                 {
                     btnAddGietMoCaChiTiet.Visible = false;
                 }
                 else
                 {
                     btnAddGietMoCaChiTiet.Visible = true;
                     isAdmin = true;
                 }
             }
         }
         grvDanhSach.DataSource = csCont.GietMoCa_GetChiTiet(int.Parse(lblGMC.Text), int.Parse(ddlRowStatus.SelectedValue));
         grvDanhSach.DataBind();
         if (grvDanhSach.Rows.Count == 0)
         {
             lblNoData.Visible = true;
         }
         else
         {
             lblNoData.Visible = false;
         }
         lblTongHoi.Text    = tongHoi.ToString("0.#####");
         lblTongMocHam.Text = tongMocHam.ToString("0.#####");
     }
     else
     {
         btnAddGietMoCaChiTiet.Visible = false;
     }
 }
Ejemplo n.º 19
0
        protected void grvDanhSach_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRow           r       = ((DataRowView)e.Row.DataItem).Row;
                HtmlInputCheckBox chkChon = (HtmlInputCheckBox)(e.Row.FindControl("chkChon"));
                chkChon.Value = r["ID"].ToString();
                HyperLink lnkEdit       = (HyperLink)(e.Row.FindControl("lnkEdit"));
                Button    btnXemThayDoi = (Button)(e.Row.FindControl("btnXemThayDoi"));
                btnXemThayDoi.CommandArgument = r["ID"].ToString();
                btnXemThayDoi.CommandName     = ddlRowStatus.SelectedValue;
                Button btnDelete = (Button)(e.Row.FindControl("btnDelete"));
                lnkEdit.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "note_edit", "noteid/" + r["ID"].ToString(), "mid/" + this.ModuleId.ToString());
                if (r["Ngay"] != DBNull.Value && Convert.ToDateTime(r["Ngay"]) < Config.NgayKhoaSo())
                {
                    //btnDelete.Visible = false;
                    btnDelete.Enabled  = false;
                    btnDelete.CssClass = "buttondisable";
                }
                btnDelete.CommandArgument = r["ID"].ToString();
                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    btnDelete.Visible = false;
                    lnkEdit.Visible   = false;
                }

                if (Convert.ToBoolean(r["Lock"]))
                {
                    e.Row.CssClass    = "GrayRow";
                    btnDelete.Visible = false;
                }
                else
                {
                    e.Row.CssClass = "NormalRow";
                }

                if (ddlRowStatus.SelectedValue == "0")
                {
                    btnDelete.Visible = false;
                    lnkEdit.Visible   = false;
                }
                btnXemThayDoi.Attributes["style"] = "background-image:url('" + ModulePath + "images/log.gif');border:none;background-color:transparent;background-repeat:no-repeat;cursor:pointer;vertical-align:middle;width:16px;";
                e.Row.Attributes["id"]            = "row_" + btnXemThayDoi.ClientID;
                e.Row.Attributes["onclick"]       = "setSelectedRow(this,'" + btnXemThayDoi.ClientID + "')";
            }
        }
Ejemplo n.º 20
0
 protected void grvDanhSach_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DataRow   r                 = ((DataRowView)e.Row.DataItem).Row;
         Button    btnBienDong       = (Button)(e.Row.FindControl("btnBienDong"));
         HyperLink lnkLichSuBienDong = (HyperLink)(e.Row.FindControl("lnkLichSuBienDong"));
         HyperLink lnkEdit           = (HyperLink)(e.Row.FindControl("lnkEdit"));
         Label     lblSoLuong        = (Label)(e.Row.FindControl("lblSoLuong"));
         btnBienDong.Attributes["onclick"] = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(int.Parse(hdVatTuBienDongPage.Value), "", "VatTu/" + r["VatTu"].ToString()) + "','',400,250);";
         if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
         {
             btnBienDong.Visible = false;
             lnkEdit.Visible     = false;
         }
         lnkLichSuBienDong.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "vattu_lichsubiendong", "mid/" + ModuleId.ToString(), "IDVatTu/" + r["VatTu"].ToString(), "loaivattu/" + ddlLoaiVatTu.SelectedValue);
         lnkEdit.NavigateUrl           = DotNetNuke.Common.Globals.NavigateURL(TabId, "vattu_edit", "mid/" + ModuleId.ToString(), "IDVatTu/" + r["VatTu"].ToString());
         lblSoLuong.Text = Config.ToXVal2(r["SoLuong"], scale);
     }
 }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    BindControls();
                    lnkCancel.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "");
                }
                DataTable tblSanPham = csCont.LoadVatTu_HienTai("SPGM_DangDung", "MoTa");
                foreach (DataRow r in tblSanPham.Rows)
                {
                    Label lbl = new Label();
                    lbl.Text = "<div style='width:100px;float:left;text-align:left;'>" + r["TenVatTu"].ToString() + "</div>";
                    dsSanPham.Controls.Add(lbl);
                    TextBox txt = new TextBox();
                    txt.ID = r["VatTu"].ToString();
                    txt.Attributes["style"] = "float:left;";
                    dsSanPham.Controls.Add(txt);
                    Label lblDVT = new Label();
                    lblDVT.Text = "<div style='text-align:left;'>&nbsp;" + r["DonViTinh"].ToString() + "</div><div style='clear:both;'></div>";
                    dsSanPham.Controls.Add(lblDVT);
                }

                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    Save.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                Save.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString() == "vi-VN")
                {
                    thapphan = ",";
                }
                else
                {
                    thapphan = ".";
                }
                scale   = int.Parse(ConfigurationManager.AppSettings["QLCS_VatTu_TA_Scale"]);
                scaleCT = scale;
                if (!Page.IsPostBack)
                {
                    BindControls();
                }

                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    btnUpdateThucAn.Visible = false;
                    btnUpdateThuoc.Visible  = false;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                btnUpdateThucAn.Visible = false;
                btnUpdateThuoc.Visible  = false;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Request.Headers["X-OFFICIAL-REQUEST"] == "TRUE")
         {
             AjaxWrapper();
         }
         else
         {
             Page.ClientScript.RegisterClientScriptInclude("jquery", ResolveUrl("~/js/impromptu/jquery.js"));
             if (!Page.IsPostBack)
             {
                 BindControls();
                 lnkCancel.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "");
                 if (Request.QueryString["tddid"] != null)
                 {
                     hdIDTDD.Value = Request.QueryString["tddid"];
                     LoadData(int.Parse(hdIDTDD.Value));
                 }
                 else
                 {
                     ddlChuong_SelectedIndexChanged(null, null);
                     Delete.Visible = false;
                 }
                 LoadThaiLoaiTrungData(int.Parse(hdIDTDD.Value));
             }
             else
             {
                 if (hdKhayUm.Value != "0")
                 {
                     DataTable dtKU = csCont.GetAvailableKhayUm(DateTime.Parse(txtNgayNo.Text, ci), int.Parse(hdIDTDD.Value));
                     ddlKhayUm.DataSource     = dtKU;
                     ddlKhayUm.DataTextField  = "Chuong";
                     ddlKhayUm.DataValueField = "IDChuong";
                     ddlKhayUm.DataBind();
                     ddlKhayUm.SelectedValue = hdKhayUm.Value;
                 }
                 if (hdKhayAp.Value != "0")
                 {
                     DataTable dtKA = csCont.GetAvailableKhayAp(DateTime.Parse(txtNgayVaoAp.Text, ci), int.Parse(hdIDTDD.Value));
                     ddlKhayAp.DataSource     = dtKA;
                     ddlKhayAp.DataTextField  = "TenKhayAp";
                     ddlKhayAp.DataValueField = "IDKhayAp";
                     ddlKhayAp.DataBind();
                     ddlKhayAp.SelectedValue = hdKhayAp.Value;
                 }
             }
             if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
             {
                 Save.Visible   = false;
                 Delete.Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 24
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("vi-VN");
         int soluong = 1;
         if (!int.TryParse(txtSoLuong.Text.Trim(), out soluong))
         {
             soluong = 1;
         }
         CaSauController csCont = new CaSauController();
         CaSauInfo       cs     = new CaSauInfo();
         cs.MaSo     = txtMaSo.Text.Trim() == ""?"0":txtMaSo.Text.Trim();
         cs.GioiTinh = int.Parse(ddlGioiTinh.SelectedValue);
         cs.Giong    = chkGiong.Checked;
         cs.LoaiCa   = int.Parse(ddlLoaiCa.SelectedValue);
         if (txtNgayNo.Text != "")
         {
             cs.NgayNo = DateTime.Parse(txtNgayNo.Text, ci);
         }
         else
         {
             cs.NgayNo = null;
         }
         if (txtNgayXuongChuong.Text != "")
         {
             cs.NgayXuongChuong = DateTime.Parse(txtNgayXuongChuong.Text, ci);
         }
         else
         {
             cs.NgayXuongChuong = DateTime.Now;
         }
         if (cs.NgayNo != null && cs.NgayNo > cs.NgayXuongChuong)
         {
             Page.ClientScript.RegisterStartupScript(typeof(string), "insertupdatefail", "alert('Ngày nở không được lớn hơn ngày xuống chuồng');", true);
             return;
         }
         if (cs.NgayXuongChuong < Config.NgayKhoaSo())
         {
             Page.ClientScript.RegisterStartupScript(typeof(string), "insertupdatefail", "alert('Ngày xuống chuồng không được trước ngày khóa sổ');", true);
             return;
         }
         cs.NguonGoc = int.Parse(ddlNguonGoc.SelectedValue);
         cs.Chuong   = int.Parse(ddlChuong.SelectedValue);
         cs.CaMe     = int.Parse(ddlCaMe.SelectedValue);
         cs.Status   = 0;
         cs.GhiChu   = "";
         int result = csCont.InsertCaSauMultiple(soluong, cs, UserId);
         if (result == -1)
         {
             Page.ClientScript.RegisterStartupScript(typeof(string), "insertupdatefail", "alert('Thêm mới không thành công');", true);
             return;
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(typeof(string), "insertsuccess", "alert('Thêm mới thành công!');", true);
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    txtNgayXuongChuong.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                    BindControls();
                    lnkCancel.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "");
                }

                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    Save.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                Save.Visible = false;
            }
        }
        protected void grvDanhSach_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRow           r          = ((DataRowView)e.Row.DataItem).Row;
                HtmlInputCheckBox chkChon    = (HtmlInputCheckBox)(e.Row.FindControl("chkChon"));
                Label             lblStatus  = (Label)(e.Row.FindControl("lblStatus"));
                Label             lblNote    = (Label)(e.Row.FindControl("lblNote"));
                HyperLink         lnkIDCaSau = (HyperLink)(e.Row.FindControl("lnkIDCaSau"));
                HyperLink         lnkCaMe    = (HyperLink)(e.Row.FindControl("lnkCaMe"));
                lnkIDCaSau.Attributes["onclick"] = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(int.Parse(hdListBienDongPage.Value), "", "IDCaSau/" + r["IDCaSau"].ToString()) + "','',800,600);";
                lnkIDCaSau.Attributes["style"]   = "cursor:pointer;font-weight:bold;";
                lnkCaMe.Attributes["onclick"]    = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(int.Parse(hdListBienDongPage.Value), "", "IDCaSau/" + r["CaMe"].ToString()) + "','',800,600);";
                lnkCaMe.Attributes["style"]      = "cursor:pointer;font-weight:bold;";
                chkChon.Attributes["name"]       = r["ID"].ToString();
                chkChon.Attributes["onclick"]    = "chon_click(event, this);";
                int tt = Convert.ToInt32(r["Status"]);
                if (tt < 0)
                {
                    lblStatus.Text = r["TrangThai"].ToString() + " (" + Convert.ToDateTime(r["LatestChange"]).ToString("dd/MM/yyyy") + ")";
                }
                else
                {
                    lblStatus.Text = r["TrangThai"].ToString();
                    if (Convert.ToInt32(r["EndStatus"]) < 0)
                    {
                        lblStatus.Text += " (" + Convert.ToDateTime(r["LatestChange"]).ToString("dd/MM/yyyy") + ")";
                    }
                }
                Button btnDeleteBienDong = (Button)(e.Row.FindControl("btnDeleteBienDong"));
                Button btnEditBienDong   = (Button)(e.Row.FindControl("btnEditBienDong"));
                Button btnXemThayDoi     = (Button)(e.Row.FindControl("btnXemThayDoi"));
                Button btnXemSPThuHoi    = (Button)(e.Row.FindControl("btnXemSPThuHoi"));
                btnXemThayDoi.CommandArgument = r["ID"].ToString();
                chkChon.Value          = r["ID"].ToString();
                btnXemSPThuHoi.Visible = false;
                if (Convert.ToDateTime(r["ThoiDiemBienDong"]) < Config.NgayKhoaSo())
                {
                    btnDeleteBienDong.Enabled  = false;
                    btnDeleteBienDong.CssClass = "buttondisable";
                    btnEditBienDong.Enabled    = false;
                    btnEditBienDong.CssClass   = "buttondisable";
                }
                else
                {
                    if (Convert.ToBoolean(r["Lock"]))
                    {
                        btnDeleteBienDong.Visible = false;
                        btnEditBienDong.Visible   = false;
                    }
                    else
                    {
                        if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                        {
                            btnDeleteBienDong.Visible = false;
                            btnEditBienDong.Visible   = false;
                        }
                        else
                        {
                            btnDeleteBienDong.Visible         = true;
                            btnEditBienDong.Visible           = true;
                            btnDeleteBienDong.CommandArgument = r["ID"].ToString();
                            btnEditBienDong.CommandArgument   = r["ID"].ToString() + "," + r["IDCaSau"].ToString() + "," + Convert.ToDateTime(r["ThoiDiemBienDong"]).ToString("dd/MM/yyyy HH:mm:ss") + "," + r["Note"].ToString();
                        }
                    }
                }

                if (r["LoaiBienDong"].ToString() == "1")
                {
                    DataTable tbl = csCont.LoadChuongByID(int.Parse(r["Note"].ToString()));
                    if (tbl != null && tbl.Rows.Count == 1)
                    {
                        lblNote.Text = tbl.Rows[0]["Chuong"].ToString();
                    }
                    btnEditBienDong.CommandName = "editchuyenchuong";
                    btnXemThayDoi.CommandName   = "chuyenchuong";
                }
                else if (r["LoaiBienDong"].ToString() == "2")
                {
                    if (r["Note"].ToString() == "1")
                    {
                        lblNote.Text = "Đực";
                    }
                    else if (r["Note"].ToString() == "-1")
                    {
                        lblNote.Text = "CXĐ";
                    }
                    else if (r["Note"].ToString() == "0")
                    {
                        lblNote.Text = "Cái";
                    }

                    btnEditBienDong.CommandName = "editchuyengioitinh";
                    btnXemThayDoi.CommandName   = "chuyengioitinh";
                }
                else if (r["LoaiBienDong"].ToString() == "3")
                {
                    DataTable tbl = csCont.LoadNguonGocByID(int.Parse(r["Note"].ToString()));
                    if (tbl != null && tbl.Rows.Count == 1)
                    {
                        lblNote.Text = tbl.Rows[0]["TenNguonGoc"].ToString();
                    }

                    btnEditBienDong.CommandName = "editchuyennguongoc";
                    btnXemThayDoi.CommandName   = "chuyennguongoc";
                }
                else if (r["LoaiBienDong"].ToString() == "4")
                {
                    DataTable tbl = csCont.LoadLoaiCaByID(int.Parse(r["Note"].ToString()));
                    if (tbl != null && tbl.Rows.Count == 1)
                    {
                        lblNote.Text = tbl.Rows[0]["TenLoaiCa"].ToString();
                    }

                    btnEditBienDong.CommandName = "editchuyenloaica";
                    btnXemThayDoi.CommandName   = "chuyenloaica";
                }
                else if (r["LoaiBienDong"].ToString() == "5")
                {
                    lblNote.Text = r["Note"].ToString();
                    btnEditBienDong.CommandName = "editchuyenmaso";
                    btnXemThayDoi.CommandName   = "chuyenmaso";
                }
                else if (r["LoaiBienDong"].ToString() == "6")
                {
                    if (r["Note"].ToString() == "0")
                    {
                        lblNote.Text = "BT";
                    }
                    else if (r["Note"].ToString() == "1")
                    {
                        lblNote.Text = "Bệnh";
                    }
                    else if (r["Note"].ToString() == "-4")
                    {
                        lblNote.Text = "Loại thải";
                    }
                    else if (r["Note"].ToString() == "-1")
                    {
                        lblNote.Text = "Chết";
                    }
                    else if (r["Note"].ToString() == "-2")
                    {
                        lblNote.Text = "Giết mổ";
                    }
                    else if (r["Note"].ToString() == "-3")
                    {
                        lblNote.Text = "Bán";
                    }
                    else
                    {
                        lblNote.Text = "--";
                    }

                    int Note = int.Parse(r["Note"].ToString());
                    if (Note == -1 || Note == -2 || Note == -4)
                    {
                        btnDeleteBienDong.Visible = false;
                        btnEditBienDong.Visible   = false;
                    }
                    btnEditBienDong.CommandName = "editchuyentrangthai";
                    btnXemThayDoi.CommandName   = "chuyentrangthai";
                    if (lblNote.Text == "Chết" || lblNote.Text == "Loại thải")
                    {
                        btnXemSPThuHoi.Visible     = true;
                        btnXemSPThuHoi.CommandName = "chet";
                    }
                }
                else if (r["LoaiBienDong"].ToString() == "7")
                {
                    if (r["Note"].ToString() == "1")
                    {
                        lblNote.Text = "Giống";
                    }
                    else
                    {
                        lblNote.Text = "Tăng trọng";
                    }

                    btnEditBienDong.CommandName = "editchuyengiong";
                    btnXemThayDoi.CommandName   = "chuyengiong";
                }
                else if (r["LoaiBienDong"].ToString() == "8")
                {
                    lblNote.Text = "";
                    btnDeleteBienDong.Visible = false;
                    btnEditBienDong.Visible   = false;
                    btnXemThayDoi.Visible     = false;
                }
                else
                {
                    lblNote.Text = r["Note"].ToString();
                    btnDeleteBienDong.Visible = false;
                    btnEditBienDong.Visible   = false;
                    btnXemThayDoi.Visible     = false;
                }

                if (Convert.ToBoolean(r["Lock"]))
                {
                    e.Row.CssClass = "GrayRow";
                }
                else
                {
                    e.Row.CssClass = "NormalRow";
                }
                btnXemThayDoi.Attributes["style"] = "background-image:url('" + ModulePath + "images/log.gif');border:none;background-color:transparent;background-repeat:no-repeat;cursor:pointer;vertical-align:middle;width:16px;";
                e.Row.Attributes["id"]            = "row_" + btnXemThayDoi.ClientID;
                e.Row.Attributes["onclick"]       = "setSelectedRow(this,'" + btnXemThayDoi.ClientID + "')";

                //btnEditBienDong.Attributes["onclick"] = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(CaSauBienDongPage, "", "type/" + btnEditBienDong.CommandName) + "','',600,400);";
                btnXemThayDoi.Attributes["onclick"]  = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(CaSauBienDongLichSuPage, "", "type/" + btnXemThayDoi.CommandName, "status/1", "IDBienDong/" + btnXemThayDoi.CommandArgument) + "','',800,400);";
                btnXemSPThuHoi.Attributes["onclick"] = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(ThuHoiDaLichSuPage, "", "status/1", "IDThuHoiDa/" + csCont.ThuHoiDa_GetIDByCa(Convert.ToInt32(r["IDCaSau"]), 1)) + "','',800,400);";
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Page.ClientScript.RegisterClientScriptInclude("jquery", ResolveUrl("~/js/impromptu/jquery.js"));
         if (!Page.IsPostBack)
         {
             BindControls();
             lnkCancel.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "");
         }
         if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
         {
             Save.Visible = false;
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Ejemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    Page.ClientScript.RegisterClientScriptInclude("jquery", ResolveUrl("~/js/jquery.js"));
                    DotNetNuke.Entities.Tabs.TabController t = new DotNetNuke.Entities.Tabs.TabController();
                    hdVatTuBienDongPage.Value = t.GetTabByName(ConfigurationManager.AppSettings["QLCS_VatTuBienDongPage"], PortalId).TabID.ToString();

                    if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                    {
                        lnkAddNew.Visible = false;
                    }
                    if (Settings["LoaiVatTu"] != null)
                    {
                        ddlLoaiVatTu.SelectedValue = Settings["LoaiVatTu"].ToString();
                    }
                    lnkAddNew.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "vattu_addnew", "mid/" + this.ModuleId.ToString(), "loaivattu/" + ddlLoaiVatTu.SelectedValue);
                    scale = int.Parse(ConfigurationManager.AppSettings["QLCS_VatTu_" + ddlLoaiVatTu.SelectedValue + "_Scale"]);
                    btnLoad_Click(null, null);
                }
                else
                {
                    scale = int.Parse(ConfigurationManager.AppSettings["QLCS_VatTu_" + ddlLoaiVatTu.SelectedValue + "_Scale"]);
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    BindControls();
                    btnLoad_Click(null, null);
                }
                else
                {
                    if (txtTuNgay.Text.Trim() == "")
                    {
                        txtTuNgay.Text = "01/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();
                    }
                    if (txtDenNgay.Text.Trim() == "")
                    {
                        txtDenNgay.Text = DateTime.Now.ToString("dd/MM/yyyy");
                    }
                }

                //Khoi tao danh sach chuong
                DataSet ds = Config.SelectSPs("QLCS_DanhMuc_GetAllChuong_TenChuong", new SqlParameter[] { });
                for (int i = 0; i < ds.Tables.Count; i++)
                {
                    ListBox lstChuong = new ListBox();
                    lstChuong.ID             = "lstChuong" + i.ToString();
                    lstChuong.DataSource     = ds.Tables[i];
                    lstChuong.DataTextField  = "Chuong";
                    lstChuong.DataValueField = "IDChuong";
                    lstChuong.CssClass       = "lstChuong";
                    lstChuong.DataBind();
                    lstChuong.Rows            = 6;
                    lstChuong.SelectionMode   = ListSelectionMode.Multiple;
                    lstChuong.EnableViewState = true;
                    phChuong.Controls.Add(lstChuong);
                }
                hdNumListChuong.Value = ds.Tables.Count.ToString();

                if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "QLCS"))
                {
                    btnDelete.Visible = false;
                    btnSave.Visible   = false;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Page.ClientScript.RegisterClientScriptInclude("jquery", ResolveUrl("~/js/jquery.js"));
                Page.ClientScript.RegisterClientScriptInclude("ac_actb", ResolveUrl("~/js/autocomplete/actb.js"));
                Page.ClientScript.RegisterClientScriptInclude("ac_common", ResolveUrl("~/js/autocomplete/common.js"));
                CaSauBienDongLichSuPage = t.GetTabByName(ConfigurationManager.AppSettings["QLCS_CaSauBienDongLichSuPage"], PortalId).TabID;
                CaSauBienDongPage       = t.GetTabByName(ConfigurationManager.AppSettings["QLCS_CaSauBienDongPage"], PortalId).TabID;
                ThuHoiDaLichSuPage      = t.GetTabByName(ConfigurationManager.AppSettings["QLCS_ThuHoiDaLichSuPage"], PortalId).TabID;
                InitGiaTriMoi();
                if (!IsPostBack)
                {
                    DataTable dtLoaiBienDong = csCont.LoadLoaiBienDong();
                    ddlLoaiBienDong.DataSource     = dtLoaiBienDong;
                    ddlLoaiBienDong.DataTextField  = "TenLoaiBienDong";
                    ddlLoaiBienDong.DataValueField = "IDLoaiBienDong";
                    ddlLoaiBienDong.DataBind();
                    ddlLoaiBienDong.Items.Insert(0, new ListItem("", "0"));

                    DataTable dtLoaiCa = csCont.LoadLoaiCa(1);
                    ddlLoaiCa.DataSource     = dtLoaiCa;
                    ddlLoaiCa.DataTextField  = "TenLoaiCa";
                    ddlLoaiCa.DataValueField = "IDLoaiCa";
                    ddlLoaiCa.DataBind();
                    ddlLoaiCa.Items.Insert(0, new ListItem("", "0"));

                    DataTable dtChuong = csCont.LoadChuong(1);
                    ddlChuong.DataSource     = dtChuong;
                    ddlChuong.DataTextField  = "Chuong";
                    ddlChuong.DataValueField = "IDChuong";
                    ddlChuong.DataBind();
                    ddlChuong.Items.Insert(0, new ListItem("", "0"));

                    DataTable dtCaMe = csCont.LoadCaSauMe_AllTrangThai();
                    ddlCaMe.DataSource     = dtCaMe;
                    ddlCaMe.DataTextField  = "CaMe";
                    ddlCaMe.DataValueField = "IDCaSau";
                    ddlCaMe.DataBind();
                    ddlCaMe.Items.Insert(0, new ListItem("", "0"));

                    DataTable dtStatus = new DataTable("Status");
                    DataRow   dr       = null;
                    dtStatus.Columns.AddRange(new DataColumn[] { new DataColumn("ID"), new DataColumn("Description") });
                    dr                = dtStatus.NewRow();
                    dr["ID"]          = 0;
                    dr["Description"] = "Bình thường";
                    dtStatus.Rows.Add(dr);
                    dr                = dtStatus.NewRow();
                    dr["ID"]          = 1;
                    dr["Description"] = "Bệnh";
                    dtStatus.Rows.Add(dr);
                    dr                = dtStatus.NewRow();
                    dr["ID"]          = -4;
                    dr["Description"] = "Loại thải";
                    dtStatus.Rows.Add(dr);
                    dr                = dtStatus.NewRow();
                    dr["ID"]          = -3;
                    dr["Description"] = "Đã bán";
                    dtStatus.Rows.Add(dr);
                    dr                = dtStatus.NewRow();
                    dr["ID"]          = -2;
                    dr["Description"] = "Giết mổ";
                    dtStatus.Rows.Add(dr);
                    dr                = dtStatus.NewRow();
                    dr["ID"]          = -1;
                    dr["Description"] = "Chết";
                    dtStatus.Rows.Add(dr);
                    ddlStatus.DataSource     = dtStatus;
                    ddlStatus.DataValueField = "ID";
                    ddlStatus.DataTextField  = "Description";
                    ddlStatus.DataBind();

                    if (Session["AutoDisplay_BDCS"] != null && Convert.ToBoolean(Session["AutoDisplay_BDCS"]))
                    {
                        txtID.Text   = Session["BDCS_ID"].ToString();
                        txtMaSo.Text = Session["BDCS_MaSo"].ToString();
                        ddlGioiTinh.SelectedValue = Session["BDCS_GioiTinh"].ToString();
                        Config.SetSelectedValues(ddlLoaiCa, Session["BDCS_LoaiCa"].ToString());
                        Config.SetSelectedValues(ddlChuong, Session["BDCS_Chuong"].ToString());
                        Config.SetSelectedValues(ddlCaMe, Session["BDCS_CaMe"].ToString());
                        if (Session["BDCS_TrangThai"] != null && Session["BDCS_TrangThai"].ToString() != "")
                        {
                            Config.SetSelectedValues(ddlStatus, Session["BDCS_TrangThai"].ToString());
                        }
                        else
                        {
                            Config.SetSelectedValues(ddlStatus, "0, 1, 2, ");
                        }
                        btnLoad_Click(null, null);
                    }
                    else
                    {
                        Config.SetSelectedValues(ddlStatus, "0, 1, 2, ");
                    }
                    if (!UserInfo.IsSuperUser && !UserInfo.IsInRole("Administrators") && !CaSauController.HasEditPermission(UserInfo.Roles, "KhoaCS"))
                    {
                        btnKhoa.Visible   = false;
                        btnMoKhoa.Visible = false;
                    }
                    hdListBienDongPage.Value = t.GetTabByName(ConfigurationManager.AppSettings["QLCS_CaSauListBienDongPage"], PortalId).TabID.ToString();
                }
            }
            catch (Exception ex)
            {
            }
        }