示例#1
0
        protected void dxgvSerial_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e)
        {
            if (e.RowType == DevExpress.Web.GridViewRowType.Data)
            {
                Label lbl = dxgvSerial.FindRowCellTemplateControl(e.VisibleIndex, null, "lblBranchName") as Label;
                string strCoCode = e.GetValue("CO_CODE").ToString();
                if (lbl != null && strCoCode != string.Empty)
                {
                    using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
                    {
                        COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(strCoCode);
                        if (objT24_COMPANY != null)
                        {
                            lbl.Text = objT24_COMPANY.COMPANY_NAME;
                        }
                    }
                }

                Label lbl2 = dxgvSerial.FindRowCellTemplateControl(e.VisibleIndex, null, "lblStatus") as Label;
                if (lbl2 != null)
                {
                    if (e.GetValue("IsUsed") != null)
                    {
                        bool strStatus = Convert.ToBoolean(e.GetValue("IsUsed"));

                        if (strStatus)
                        {
                            lbl2.Text = "Đã cấp mã";
                        }
                        else
                        {
                            lbl2.Text = "Đã xóa";
                        }
                    }
                    else
                    {
                        lbl2.Text = "Đã cấp mã";
                    }
                }

                Label lbl3 = dxgvSerial.FindRowCellTemplateControl(e.VisibleIndex, null, "lblMaDuThuong") as Label;
                if (lbl3 != null)
                {
                    if (e.GetValue("Serials") != null)
                    {
                        string strSerials = e.GetValue("Serials").ToString();
                        if (!string.IsNullOrEmpty(strSerials))
                        {
                            strSerials = Common.FormatSerial(strSerials.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries).ToList());
                        }

                        lbl3.Text = strSerials;
                    }
                    else
                    {
                        lbl3.Text = string.Empty;
                    }
                }
            }
        }
示例#2
0
        protected void dxgvLiXi_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e)
        {
            if (e.RowType == DevExpress.Web.GridViewRowType.Data)
            {
                Label lbl = dxgvLiXi.FindRowCellTemplateControl(e.VisibleIndex, null, "lblBranchName") as Label;
                string strCoCode = e.GetValue("CoCode").ToString();
                if (lbl != null && strCoCode != string.Empty)
                {
                    using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
                    {
                        COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(strCoCode);
                        if (objT24_COMPANY != null)
                        {
                            lbl.Text = objT24_COMPANY.COMPANY_NAME;
                        }
                    }
                }

                Label lbl2 = dxgvLiXi.FindRowCellTemplateControl(e.VisibleIndex, null, "lblStatus") as Label;
                if (lbl2 != null)
                {
                    if (e.GetValue("IsUsed") != null)
                    {
                        bool strStatus = Convert.ToBoolean(e.GetValue("IsUsed"));

                        if (strStatus)
                        {
                            lbl2.Text = "Đã cấp";
                        }
                        else
                        {
                            lbl2.Text = "Đã xóa";
                        }
                    }
                    else
                    {
                        lbl2.Text = "Đã cấp";
                    }
                }
            }
        }
示例#3
0
        protected void grvExport_RenderBrick(object sender, DevExpress.Web.ASPxGridViewExportRenderingEventArgs e)
        {
            GridViewDataColumn dataColumn = e.Column as GridViewDataColumn;
            if (e.RowType == GridViewRowType.Data && dataColumn != null && dataColumn.VisibleIndex == 8)
            {
                string strCoCode = e.GetValue("CoCode").ToString();
                if (strCoCode != string.Empty)
                {
                    using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
                    {
                        COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(strCoCode);
                        if (objT24_COMPANY != null)
                        {
                            e.TextValue = objT24_COMPANY.COMPANY_NAME;
                        }
                    }
                }
            }

            dataColumn = e.Column as GridViewDataColumn;
            if (e.RowType == GridViewRowType.Data && dataColumn != null && dataColumn.VisibleIndex == 9)
            {
                if (e.GetValue("IsUsed") != null)
                {
                    bool strStatus = Convert.ToBoolean(e.GetValue("IsUsed"));

                    if (strStatus)
                    {
                        e.TextValue = "Đã cấp";
                    }
                    else
                    {
                        e.TextValue = "Đã xóa";
                    }
                }
                else
                {
                    e.TextValue = "Đã cấp";
                }
            }
        }
示例#4
0
 private void BindBranch()
 {
     using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
     {
         List<COMPANY> lstData = objT24_COMPANY_BO.GetAll().ToList();
         foreach (COMPANY item in lstData)
         {
             cboBranch.Items.Add(new ListItem(item.COMPANY_CODE + "-" + item.COMPANY_NAME, item.COMPANY_CODE));
         }
         cboBranch.Items.Insert(0, new ListItem("--Chọn chi nhánh--", string.Empty));
         if (Session[Commons.Constant.DAO_CODE] != null)
         {
             cboBranch.ClearSelection();
             using (DAO_COMPANY_BO objDAO_COMPANY_BO = new DAO_COMPANY_BO())
             {
                 List<DAO_COMPANY> lstDaoCompany = objDAO_COMPANY_BO.GetByDAO_CODE(Session[Commons.Constant.DAO_CODE].ToString()).ToList();
                 if (lstDaoCompany != null)
                 {
                     foreach (DAO_COMPANY item in lstDaoCompany)
                     {
                         if (item.DAO_CODE == Session[Commons.Constant.DAO_CODE].ToString() && !string.IsNullOrEmpty(item.COMPANY_CODE.Trim()))
                         {
                             if (cboBranch.Items.FindByValue(item.COMPANY_CODE) != null)
                             {
                                 cboBranch.Items.FindByValue(item.COMPANY_CODE).Selected = true;
                             }
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
示例#5
0
 private void BindBranch()
 {
     using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
     {
         List<COMPANY> lstData = objT24_COMPANY_BO.GetAll().ToList();
         foreach (COMPANY item in lstData)
         {
             cboBranch.Items.Add(new ListItem(item.COMPANY_CODE + "-" + item.COMPANY_NAME, item.COMPANY_CODE));
         }
         cboBranch.Items.Insert(0, new ListItem("--Chọn chi nhánh--", string.Empty));
         if (Session[Promotion.Commons.Constant.DAO_CODE] != null)
         {
             cboBranch.ClearSelection();
             if (cboBranch.Items.FindByValue(Session[Promotion.Commons.Constant.DAO_CODE].ToString()) != null)
             {
                 cboBranch.Items.FindByValue(Session[Promotion.Commons.Constant.DAO_CODE].ToString()).Selected = true;
             }
         }
         using (Promotion.DataModel.User_BO objUser_BO = new Promotion.DataModel.User_BO())
         {
             Promotion.DataModel.User objUser = objUser_BO.GetByUserName(Session[Promotion.Commons.Constant.USERNAME].ToString());
             if (objUser != null && objUser.Permisions != null)
             {
                 bool hasPer = false;
                 foreach (Promotion.DataModel.Permision item in objUser.Permisions)
                 {
                     if (item != null && item.Permision1 == Constant.PERMISION_ADMIN)
                     {
                         hasPer = true;
                         break;
                     }
                 }
                 if (hasPer)
                 {
                     cboBranch.Enabled = true;
                 }
             }
         }
     }
 }
示例#6
0
        protected void grvExport_RenderBrick(object sender, DevExpress.Web.ASPxGridViewExportRenderingEventArgs e)
        {
            GridViewDataColumn dataColumn = e.Column as GridViewDataColumn;
            if (e.RowType == GridViewRowType.Data && dataColumn != null && dataColumn.VisibleIndex == 7)
            {
                if (e.GetValue("Serials") != null)
                {
                    string strSerials = e.GetValue("Serials").ToString();
                    if (!string.IsNullOrEmpty(strSerials))
                    {
                        strSerials = Common.FormatSerial(strSerials.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries).ToList());
                    }

                    e.TextValue = strSerials;
                }
                else
                {
                    e.TextValue = string.Empty;
                }
            }

            dataColumn = e.Column as GridViewDataColumn;
            if (e.RowType == GridViewRowType.Data && dataColumn != null && dataColumn.VisibleIndex == 9)
            {
                string strCoCode = e.GetValue("CO_CODE").ToString();
                if (strCoCode != string.Empty)
                {
                    using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
                    {
                        COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(strCoCode);
                        if (objT24_COMPANY != null)
                        {
                            e.TextValue = objT24_COMPANY.COMPANY_NAME;
                        }
                    }
                }
            }

            dataColumn = e.Column as GridViewDataColumn;
            if (e.RowType == GridViewRowType.Data && dataColumn != null && dataColumn.VisibleIndex == 10)
            {
                if (e.GetValue("IsUsed") != null)
                {
                    bool strStatus = Convert.ToBoolean(e.GetValue("IsUsed"));

                    if (strStatus)
                    {
                        e.TextValue = "Đã cấp mã";
                    }
                    else
                    {
                        e.TextValue = "Đã xóa";
                    }
                }
                else
                {
                    e.TextValue = "Đã cấp mã";
                }
            }
        }