Example #1
0
 void FillPrincipalIdCombo(ASPxComboBox comboBox, string principalType)
 {
     if (principalType == "User")
     {
         using (var context = new DotWebDb())
         {
             var users = context.Users.ToList();
             comboBox.DataSource = users;
             comboBox.ValueField = "Id";
             comboBox.TextField  = "UserName";
             comboBox.DataBind();
         }
     }
     else if (principalType == "Group")
     {
         using (var context = new DotWebDb())
         {
             int appId      = int.Parse(Session["AppId"].ToString());
             var userGroups = context.UserGroups.Where(g => g.AppId == appId).ToList();
             comboBox.DataSource = userGroups;
             comboBox.ValueField = "Id";
             comboBox.TextField  = "GroupName";
             comboBox.DataBind();
         }
     }
 }
Example #2
0
    protected void ComboCSLX_Callback(object sender, CallbackEventArgsBase e)
    {
        string so = e.Parameter;

        string    sql = "select DISTINCT  cslxdm from veps_cspzb where so= '" + so + "' order by cslxdm";
        DataTable dt  = dc.GetTable(sql);

        ASPxComboBox Cslx = sender as ASPxComboBox;

        Cslx.DataSource = dt;
        Cslx.DataBind();
        Cslx.ValueField = "CSLXDM";
        Cslx.TextField  = "CSLXDM";
        Cslx.DataBind();
    }
Example #3
0
        protected void cmbzd_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            //initZd();
            ASPxComboBox station = (ASPxComboBox)sender;
            string       sql     = " SELECT DISTINCT a.STATION_CODE FROM DATA_STORE a left join CODE_STATION b on b.STATION_NAME=a.STATION_CODE "
                                   + " where 1=1 ";

            if (txtPCode.Text.Trim() != "")
            {
                sql += " AND A.PLINE_CODE = '" + txtPCode.Value.ToString() + "' ";
            }
            if (cmbqy.Text.Trim() != "")
            {
                sql += " AND B.STATION_AREA = '" + cmbqy.Text.Trim() + "' ";
            }
            if (cmbfl.Text.Trim() != "")
            {
                //??站点分类应该对应STATION_TYPE_CODE
                sql += " AND B.STATION_TYPE = '" + cmbfl.Text.Trim() + "' ";
            }
            sql += " ORDER BY A.STATION_CODE ";
            DataTable dt = dc.GetTable(sql);

            //sqlzd.SelectCommand = sql;
            //sqlzd.DataBind();
            station.DataSource = dt;
            station.DataBind();
        }
Example #4
0
        private void Load_cmbNoiNghiPhep()
        {
            DataSet      ds             = SqlHelper.ExecuteDataset(strconn, "[HRM_GetTimKiemCmb]");
            ASPxComboBox cmbNoiNghiPhep = grdContract.FindEditFormTemplateControl("cmbNoiNghiPhep") as ASPxComboBox;

            cmbNoiNghiPhep.DataSource = ds.Tables[5];
            cmbNoiNghiPhep.ValueField = "Id";
            cmbNoiNghiPhep.TextField  = "ten";
            cmbNoiNghiPhep.DataBind();

            if (!grdContract.IsNewRowEditing)
            {
                var ProvinceId = cmbNoiNghiPhep.Items.FindByValue(Int32.Parse(grdContract.GetRowValues(grdContract.EditingRowVisibleIndex, "ProvinceId").ToString()));
                if (ProvinceId != null)
                {
                    ProvinceId.Selected = true;
                }
                else
                {
                    cmbNoiNghiPhep.SelectedIndex = 0;
                }
            }
            else
            {
                cmbNoiNghiPhep.SelectedIndex = 0;
            }
        }
Example #5
0
        protected void CreatorStatus_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = AccountClass.UserStatusTable();
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;

            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "ID";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 0;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "NAME";
            l_TextField.Caption   = "STATUS";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "ID";
            combo.TextField  = "NAME";
            combo.DataBind();

            combo.Value = sBUSSUCreatorStatusKey.ToString();
        }
Example #6
0
        protected void EntityCode_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = GlobalClass.EntityTable();
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;
            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "ID";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 30;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "NAME";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "ID";
            combo.TextField  = "NAME";
            combo.DataBind();
            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;

            GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer;

            //MRPClass.PrintString("exp:" + !container.Grid.IsNewRowEditing);
            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "EntityCode").ToString();
            }
        }
Example #7
0
        protected void colSupplierCode_ItemRequestedByValue(object source, DevExpress.Web.ASPxEditors.ListEditItemRequestedByValueEventArgs e)
        {
            ASPxComboBox combo = (ASPxComboBox)source;

            if (e.Value == null)
            {
                return;
            }

            string sql = "select result.Code, result.Name" +
                         " from (select a.Code, b.Name" +
                         " from dbo.Supplier a, dbo.SupplierProperty b" +
                         " where a.SupplierId = b.SupplierId" +
                         " and b.Language = @lang" +
                         " and ((a.Code = @filter))) as result";

            SupplierSDS.SelectCommand = sql;

            SupplierSDS.SelectParameters.Clear();
            SupplierSDS.SelectParameters.Add("filter", TypeCode.String, e.Value.ToString());
            SupplierSDS.SelectParameters.Add("lang", TypeCode.String, "VN");

            combo.DataSource = SupplierSDS;
            combo.DataBind();
        }
        protected void cmbHangHoa_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox comboBox = (ASPxComboBox)source;

            //IDTrangThaiHang = 1  Hàng Hóa Thường
            //IDTrangThaiHang = 3 Hàng Ngừng Nhập
            dsHangHoa.SelectCommand = @"SELECT [ID], [MaHang], [TenHangHoa], [GiaBan] , [TenDonViTinh]
                                        FROM (
	                                        select GPM_HangHoa.ID, GPM_HangHoa.MaHang, GPM_HangHoa.TenHangHoa, GPM_HangHoaTonKho.GiaBan, GPM_DonViTinh.TenDonViTinh, 
	                                        row_number()over(order by GPM_HangHoa.MaHang) as [rn] 
	                                        FROM GPM_DonViTinh INNER JOIN GPM_HangHoa ON GPM_DonViTinh.ID = GPM_HangHoa.IDDonViTinh 
                                                               INNER JOIN GPM_HangHoaTonKho ON GPM_HangHoaTonKho.IDHangHoa = GPM_HangHoa.ID
	                                        WHERE (GPM_HangHoa.MaHang LIKE @MaHang) AND (GPM_HangHoa.IDTrangThaiHang = 1 OR GPM_HangHoa.IDTrangThaiHang = 3 ) AND (GPM_HangHoaTonKho.IDKho = @IDKho) AND (GPM_HangHoaTonKho.DaXoa = 0)	
	                                        ) as st 
                                        where st.[rn] between @startIndex and @endIndex";

            dsHangHoa.SelectParameters.Clear();
            dsHangHoa.SelectParameters.Add("MaHang", TypeCode.String, string.Format("%{0}%", e.Filter));
            dsHangHoa.SelectParameters.Add("TenHang", TypeCode.String, string.Format("%{0}%", e.Filter));
            dsHangHoa.SelectParameters.Add("IDKho", TypeCode.Int32, Session["IDKho"].ToString());
            dsHangHoa.SelectParameters.Add("startIndex", TypeCode.Int64, (e.BeginIndex + 1).ToString());
            dsHangHoa.SelectParameters.Add("endIndex", TypeCode.Int64, (e.EndIndex + 1).ToString());
            comboBox.DataSource = dsHangHoa;
            comboBox.DataBind();
        }
Example #9
0
        protected void UserStatus_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = AccountClass.UserStatusTable();
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;

            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "ID";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 0;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "NAME";
            l_TextField.Caption   = "STATUS";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "ID";
            combo.TextField  = "NAME";
            combo.DataBind();

            GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "StatusKey").ToString();
            }
        }
Example #10
0
        protected void workflowDropStatus_Init(object sender, EventArgs e)
        {
            ASPxComboBox dropStatus = (ASPxComboBox)sender;

            dropStatus.DataSource = common_services.GetCustomDropDown("workflow");
            dropStatus.DataBind();
        }
Example #11
0
        protected void BUCode_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = GlobalClass.EntBUSSUTable(sEntCode);
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;

            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "ID";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 30;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "NAME";
            l_TextField.Caption   = "NAME";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "ID";
            combo.TextField  = "NAME";
            combo.DataBind();

            combo.Value = sBUCode;
        }
 protected void cmbHangHoa_ItemRequestedByValue(object source, ListEditItemRequestedByValueEventArgs e)
 {
     if (ckHoaDon.Checked == true && cmbHoaDon.Text != "")
     {
         cmbHangHoa.DataSource = data.DanhSachHangHoa_HoaDon(cmbHoaDon.Value.ToString());
         cmbHangHoa.ValueField = "IDHangHoa";
         cmbHangHoa.DataBind();
     }
     else
     {
         long value = 0;
         if (e.Value == null || !Int64.TryParse(e.Value.ToString(), out value))
         {
             return;
         }
         ASPxComboBox comboBox = (ASPxComboBox)source;
         dsHangHoa.SelectCommand = @"SELECT GPM_HangHoa.ID, GPM_HangHoa.MaHang, GPM_HangHoa.TenHangHoa, GPM_DonViTinh.TenDonViTinh 
                                 FROM GPM_DonViTinh INNER JOIN GPM_HangHoa ON GPM_DonViTinh.ID = GPM_HangHoa.IDDonViTinhSi 
                                                    INNER JOIN GPM_HangHoaTonKho ON GPM_HangHoaTonKho.IDHangHoa = GPM_HangHoa.ID 
                                 WHERE (GPM_HangHoa.ID = @ID)";
         dsHangHoa.SelectParameters.Clear();
         dsHangHoa.SelectParameters.Add("ID", TypeCode.Int64, e.Value.ToString());
         comboBox.DataSource = dsHangHoa;
         comboBox.DataBind();
     }
 }
        private void load_data_combo()
        {
            ASPxComboBox cmb_trinhdo    = gridKhoaDaoTaoKeHoach.FindEditFormTemplateControl("cmb_trinhdo") as ASPxComboBox;
            ASPxComboBox cmb_namkehoach = gridKhoaDaoTaoKeHoach.FindEditFormTemplateControl("cmb_namkehoach") as ASPxComboBox;
            DataSet      ds             = SqlHelper.ExecuteDataset(strconn, "HRM_GET_KHOADAOTAOKEHOACHDAIHAN", 0, 1);

            cmb_trinhdo.DataSource = ds.Tables[0];
            cmb_trinhdo.ValueField = "id";
            cmb_trinhdo.TextField  = "ten";
            cmb_trinhdo.DataBind();
            int i = 0;

            while (i <= 3)
            {
                cmb_namkehoach.Items.Add("Năm " + (DateTime.Now.Year + i), (DateTime.Now.Year + i));
                i++;
            }

            if (!gridKhoaDaoTaoKeHoach.IsNewRowEditing)
            {
                var itemcndt = cmb_trinhdo.Items.FindByValue(gridKhoaDaoTaoKeHoach.GetRowValues(gridKhoaDaoTaoKeHoach.FocusedRowIndex, "idtrinhdo"));
                if (itemcndt != null)
                {
                    itemcndt.Selected = true;
                }
            }
            var valnkh  = gridKhoaDaoTaoKeHoach.GetRowValues(gridKhoaDaoTaoKeHoach.FocusedRowIndex, "tungay");
            var itemnkh = cmb_namkehoach.Items.FindByValue(Convert.ToDateTime(valnkh).Year);

            if (itemnkh != null)
            {
                itemnkh.Selected = true;
            }
        }
        protected void BUCallBackPanel_Callback(object sender, CallbackEventArgsBase e)
        {
            ASPxPageControl pageControl = BUDeptListGrid.FindEditFormTemplateControl("BUHeadPageControl") as ASPxPageControl;
            ASPxComboBox    entCode     = pageControl.FindControl("EntityCode") as ASPxComboBox;

            ASPxCallbackPanel callBackPanel = pageControl.FindControl("BUCallBackPanel") as ASPxCallbackPanel;
            ASPxComboBox      buCode        = callBackPanel.FindControl("BUCode") as ASPxComboBox;

            buCode.Value = "";
            buCode.Text  = "";

            DataTable dtRecord = GlobalClass.EntBUSSUTable(entCode.Value.ToString());

            buCode.DataSource = dtRecord;

            //ListBoxColumn l_value = new ListBoxColumn();
            //l_value.FieldName = "ID";
            //l_value.Caption = "ID";
            //buCode.Columns.Add(l_value);

            //ListBoxColumn l_text = new ListBoxColumn();
            //l_text.FieldName = "NAME";
            //l_text.Caption = "Name";
            //buCode.Columns.Add(l_text);

            buCode.TextField        = "NAME";
            buCode.ValueField       = "ID";
            buCode.TextFormatString = "{1}";
            buCode.DataBind();
        }
Example #15
0
        private void LocationCombo_Data()
        {
            ASPxComboBox combo = LocationCombo as ASPxComboBox;

            combo.Columns.Clear();

            combo.Value = "";

            combo.DataSource = POClass.InventSiteLocationTable(WarehouseCombo.Text.ToString());

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "LocationCode";
            combo.Columns.Add(l_value);

            //ListBoxColumn l_text = new ListBoxColumn();
            //l_text.FieldName = "NAME";
            //Location.Columns.Add(l_text);

            //Location.TextField = "NAME";
            combo.ValueField = "LocationCode";
            combo.DataBind();
            combo.TextFormatString = "{0}";
            combo.ClientEnabled    = true;
        }
Example #16
0
        protected void POUOM_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = sender as ASPxComboBox;

            combo.DataSource     = MRPClass.UOMTable();
            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "SYMBOL";
            combo.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "description";
            combo.Columns.Add(l_text);

            combo.ValueField = "SYMBOL";
            combo.TextField  = "description";
            combo.DataBind();
            combo.TextFormatString = "{0}";

            GridViewEditItemTemplateContainer container = ((ASPxComboBox)sender).NamingContainer as GridViewEditItemTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "POUOM").ToString();
            }
        }
Example #17
0
        private void SiteCombo_Data()
        {
            ASPxComboBox combo = SiteCombo as ASPxComboBox;

            combo.Columns.Clear();
            combo.DataSource = POClass.InventSiteTable(entity);

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "SITEID";
            l_value.Caption   = "Site ID";
            combo.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "NAME";
            l_text.Width     = 200;
            l_text.Caption   = "Name";
            combo.Columns.Add(l_text);

            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
            combo.TextField      = "NAME";
            combo.ValueField     = "SITEID";
            combo.DataBind();
        }
Example #18
0
        private void WarehouseCombo_Data()
        {
            ASPxComboBox combo = WarehouseCombo as ASPxComboBox;

            combo.Columns.Clear();

            combo.Value      = "";
            combo.DataSource = POClass.InventSiteWarehouseTable(SiteCombo.Text.ToString());

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "warehouse";
            l_value.Caption   = "Warehouse";
            combo.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "NAME";
            l_text.Caption   = "Name";
            combo.Columns.Add(l_text);

            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
            combo.TextField      = "NAME";
            combo.ValueField     = "warehouse";
            combo.DataBind();
            combo.ClientEnabled = true;
        }
        protected void Code_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = sender as ASPxComboBox;

            combo.DataSource = POClass.PO_EntityCode_Table();

            ListBoxColumn lv = new ListBoxColumn();

            lv.FieldName = "ID";
            lv.Caption   = "Code";
            lv.Width     = 50;
            combo.Columns.Add(lv);

            ListBoxColumn lt = new ListBoxColumn();

            lt.FieldName = "NAME";
            lt.Caption   = "Entity";
            lt.Width     = 250;
            combo.Columns.Add(lt);

            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
            combo.ValueField     = "ID";
            combo.TextField      = "NAME";
            combo.DataBind();

            GridViewEditItemTemplateContainer container = ((ASPxComboBox)sender).NamingContainer as GridViewEditItemTemplateContainer;

            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "Code").ToString();
                combo.Text  = DataBinder.Eval(container.DataItem, "Code").ToString();
            }
        }
Example #20
0
        private void VendorCombo_Data()
        {
            ASPxComboBox combo = VendorCombo as ASPxComboBox;

            combo.Columns.Clear();
            combo.DataSource = POClass.VendTableTable();;

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "ACCOUNTNUM";
            l_value.Caption   = "Vendor Code";
            l_value.Width     = 100;
            combo.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "NAME";
            l_text.Caption   = "Vendor Name";
            l_text.Width     = 350;
            combo.Columns.Add(l_text);

            combo.ItemStyle.Wrap = DevExpress.Utils.DefaultBoolean.True;
            combo.ValueField     = "ACCOUNTNUM";
            combo.TextField      = "NAME";
            combo.DataBind();
        }
        protected void BUHead_Init(object sender, EventArgs e)
        {
            DataTable    dtRecord = AccountClass.UserList();
            ASPxComboBox combo    = sender as ASPxComboBox;

            combo.DataSource = dtRecord;
            ListBoxColumn l_ValueField = new ListBoxColumn();

            l_ValueField.FieldName = "PK";
            l_ValueField.Caption   = "CODE";
            l_ValueField.Width     = 0;
            combo.Columns.Add(l_ValueField);

            ListBoxColumn l_TextField = new ListBoxColumn();

            l_TextField.FieldName = "CompleteName";
            l_TextField.Caption   = "Employee Name";
            combo.Columns.Add(l_TextField);

            combo.ValueField = "PK";
            combo.TextField  = "CompleteName";
            combo.DataBind();

            GridViewEditFormTemplateContainer container = combo.NamingContainer.NamingContainer as GridViewEditFormTemplateContainer;

            //MRPClass.PrintString("exp:" + !container.Grid.IsNewRowEditing);
            if (!container.Grid.IsNewRowEditing)
            {
                combo.Value = DataBinder.Eval(container.DataItem, "BUHead").ToString();
            }
        }
Example #22
0
        protected void MonthYear_Combo_Init(object sender, EventArgs e)
        {
            ASPxComboBox combo = sender as ASPxComboBox;

            combo.DataSource = POClass.MRPMonthYearTable();

            ListBoxColumn l_value = new ListBoxColumn();

            l_value.FieldName = "PK";
            l_value.Width     = 0;
            combo.Columns.Add(l_value);

            ListBoxColumn l_text = new ListBoxColumn();

            l_text.FieldName = "MRPMonth";
            l_text.Caption   = "Month";
            combo.Columns.Add(l_text);

            ListBoxColumn l_text2 = new ListBoxColumn();

            l_text2.FieldName = "MRPYear";
            l_text2.Caption   = "Year";
            combo.Columns.Add(l_text2);

            combo.ValueField = "PK";
            combo.TextField  = "MRPMonth";
            combo.DataBind();
            combo.TextFormatString = "{1} {2}";
        }
Example #23
0
        protected void cmbzd_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            //initZd();
            ASPxComboBox station = (ASPxComboBox)sender;
            string       sql     = " SELECT DISTINCT a.STATION_CODE,b.STATION_NAME FROM DATA_STORE a left join CODE_STATION b on b.STATION_CODE=a.STATION_CODE "
                                   + " where 1=1 "
                                   + " AND a.PLINE_CODE IN (select distinct c.pline_code from vw_user_role_program c where c.user_id='" + theUserId + "' and c.program_code='" + theProgramCode + "' and c.company_code='" + theCompanyCode + "') ";

            if (txtPCode.Text.Trim() != "")
            {
                sql += " AND A.PLINE_CODE = '" + txtPCode.Value.ToString() + "' ";
            }
            if (cmbqy.Text.Trim() != "")
            {
                sql += " AND B.STATION_AREA = '" + cmbqy.Text.Trim() + "' ";
            }
            if (cmbfl.Text.Trim() != "")
            {
                //??站点分类应该对应STATION_TYPE_CODE
                sql += " AND B.STATION_TYPE = '" + cmbfl.Text.Trim() + "' ";
            }
            sql += " ORDER BY A.STATION_CODE ";
            DataTable dt = dc.GetTable(sql);

            //sqlzd.SelectCommand = sql;
            //sqlzd.DataBind();
            station.DataSource = dt;
            station.DataBind();
        }
        protected void cmbHangHoa_ItemsRequestedByFilterCondition(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            if (ckHoaDon.Checked == true && cmbHoaDon.Text != "")
            {
                cmbHangHoa.DataSource = data.DanhSachHangHoa_HoaDon(cmbHoaDon.Value.ToString());
                cmbHangHoa.ValueField = "IDHangHoa";
                cmbHangHoa.DataBind();
            }
            else
            {
                ASPxComboBox comboBox = (ASPxComboBox)source;
                dsHangHoa.SelectCommand = @"SELECT [ID], [MaHang], [TenHangHoa] , [TenDonViTinh]
                                        FROM (
	                                        select GPM_HangHoa.ID, GPM_HangHoa.MaHang, GPM_HangHoa.TenHangHoa, GPM_DonViTinh.TenDonViTinh, 
	                                        row_number()over(order by GPM_HangHoa.MaHang) as [rn] 
	                                        FROM GPM_DonViTinh INNER JOIN GPM_HangHoa ON GPM_DonViTinh.ID = GPM_HangHoa.IDDonViTinhSi 
                                                               INNER JOIN GPM_HangHoaTonKho ON GPM_HangHoaTonKho.IDHangHoa = GPM_HangHoa.ID
	                                        WHERE ((GPM_HangHoa.MaHang LIKE @MaHang) OR GPM_HangHoa.TenHangHoa LIKE @TenHang)  AND (GPM_HangHoaTonKho.IDKho = @IDKho) AND (GPM_HangHoaTonKho.DaXoa = 0)	
	                                        ) as st 
                                        where st.[rn] between @startIndex and @endIndex";
                dsHangHoa.SelectParameters.Clear();
                dsHangHoa.SelectParameters.Add("MaHang", TypeCode.String, string.Format("%{0}%", e.Filter));
                dsHangHoa.SelectParameters.Add("TenHang", TypeCode.String, string.Format("%{0}%", e.Filter));
                dsHangHoa.SelectParameters.Add("IDKho", TypeCode.Int32, Session["IDKho"].ToString());
                dsHangHoa.SelectParameters.Add("startIndex", TypeCode.Int64, (e.BeginIndex + 1).ToString());
                dsHangHoa.SelectParameters.Add("endIndex", TypeCode.Int64, (e.EndIndex + 1).ToString());
                comboBox.DataSource = dsHangHoa;
                comboBox.DataBind();
            }
        }
Example #25
0
        protected void workflowdropUser_Init(object sender, EventArgs e)
        {
            ASPxComboBox dropUser = (ASPxComboBox)sender;

            dropUser.DataSource = rc_services.GetUsers();
            dropUser.DataBind();
        }
Example #26
0
        private void load_dataCombox()
        {
            DataSet      ds = SqlHelper.ExecuteDataset(strconn, "[HRM_ThiDua_Combo]");
            ASPxComboBox cmbThanhTichUpdate = grid.FindEditFormTemplateControl("cmbThanhTichUpdate") as ASPxComboBox;

            cmbThanhTichUpdate.DataSource = ds.Tables[0];
            cmbThanhTichUpdate.ValueField = "id";
            cmbThanhTichUpdate.TextField  = "ten";
            cmbThanhTichUpdate.DataBind();

            ASPxComboBox cmbDoiTuongUpdate = grid.FindEditFormTemplateControl("cmbDoiTuongUpdate") as ASPxComboBox;

            cmbDoiTuongUpdate.Items.Add(new ListEditItem("-- Tất cả --", 2));
            cmbDoiTuongUpdate.Items.Add(new ListEditItem("Tập thể", 0));
            cmbDoiTuongUpdate.Items.Add(new ListEditItem("Cá nhân", 1));
            cmbDoiTuongUpdate.SelectedIndex = 0;


            if (!grid.IsNewRowEditing)
            {
                var itemThanhTich = cmbThanhTichUpdate.Items.FindByValue(grid.GetRowValues(grid.EditingRowVisibleIndex, "idthanhtich"));
                if (itemThanhTich != null)
                {
                    itemThanhTich.Selected = true;
                }
                var itemDoiTuong = cmbDoiTuongUpdate.Items.FindByValue(grid.GetRowValues(grid.EditingRowVisibleIndex, "Loai"));
                if (itemDoiTuong != null)
                {
                    itemDoiTuong.Selected = true;
                }
            }
        }
Example #27
0
        protected void cmbSearchStudent_ItemsRequestedByFilterCondition(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox comboBox = (ASPxComboBox)source;

            comboBox.DataSource = new StudentService().FindStudent(e.Filter, e.BeginIndex, e.EndIndex + 5, new SessionManager().GetUserId(this.Session));
            comboBox.DataBind();
        }
Example #28
0
    //绑定管理对象
    private void bindGLDX(int id, ASPxComboBox comb)
    {
        string oracletext = "select * from M_OBJECT where RISK_TYPESID = " + id + "";

        comb.DataSource = OracleHelper.Query(oracletext);
        comb.DataBind();
    }
Example #29
0
        //根据日期查询单据号
        protected void ComboBillCode_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
        {
            ASPxComboBox asp = (ASPxComboBox)sender;
            string       sql = "";

            sql = "SELECT DISTINCT BILL_CODE FROM MS_SFJIT_RESULT WHERE 1=1 ";
            if (ComboGzdd.Value != null)
            {
                sql += " AND GZDD = '" + ComboGzdd.Value.ToString() + "' ";
            }
            if (DateStart.Text.Trim() != "")
            {
                sql += " AND REQUIRE_TIME >= TO_DATE('" + DateStart.Text + "','YYYY-MM-DD HH24:MI:SS') ";
            }
            if (DateEnd.Text.Trim() != "")
            {
                sql += " AND REQUIRE_TIME <= TO_DATE('" + DateEnd.Text + "','YYYY-MM-DD HH24:MI:SS') ";
            }
            sql += " ORDER BY SUBSTR(BILL_CODE,-14,14)";

            sqlBillCode.SelectCommand = sql;
            sqlBillCode.DataBind();
            asp.DataBind();
            //默认选择第一项,不然不知道是否刷新数据
            ComboBillCode.SelectedIndex = ComboBillCode.Items.Count >= 0 ? 0 : -1;
            //ASPxGridView1.DataSource = null;
            //ASPxGridView1.DataBind();
            //ASPxGridView2.DataSource = null;
            //ASPxGridView2.DataBind();
        }
Example #30
0
    private void Bindcombox(int fid, ASPxComboBox comx)
    {
        string oracletext = "select * from CS_BASEINFOSET where FID = " + fid + " ";

        comx.DataSource = OracleHelper.Query(oracletext);
        comx.DataBind();
    }
Example #31
0
    public static void SetDDLORG(ASPxComboBox ddl)
    {
        try
        {
            string sql = "SELECT '' ORG_SERIAL,'เลือกหน่วยงาน' ORG_NAME,'' ORG_ABBR UNION ALL SELECT CONVERT(varchar,ORG_SERIAL) ORG_SERIAL,ORG_NAME,ORG_ABBR FROM vw_SMM_ORG";
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();
                ddl.Columns.Add("ORG_NAME", "ชื่อหน่วยงาน");
                ddl.Columns.Add("ORG_ABBR", "ชื่อย่อ");

                ddl.ValueField = "ORG_SERIAL";
                ddl.TextField = "ORG_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #32
0
    public static void SetDDLJDSUBGROP34(ASPxComboBox ddl,int GroupID)
    {
        try
        {
            string sql = "SELECT SUB_GROUP_ID,SUB_GROUP_NAME FROM SMM_JD_SUB_GROUP34 WHERE GROUP_ID="+ GroupID ;
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {

                ddl.ValueField = "SUB_GROUP_ID";
                ddl.TextField = "SUB_GROUP_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #33
0
    public static void SetDDLJDEVALSCORE(ASPxComboBox ddl)
    {
        try
        {

            DataTable dt =new DataTable();
            dt.Columns.Add("Score_ID");
            dt.Columns.Add("Score_Name");

            DataRow dr ;
            dr=dt.NewRow();
            dr["Score_ID"]="0";
            dr["Score_Name"]="เลือกระดับ";
            dt.Rows.Add(dr);

            dr=dt.NewRow();
            dr["Score_ID"]="1";
            dr["Score_Name"]="ระดับ 1";
            dt.Rows.Add(dr);

            dr=dt.NewRow();
            dr["Score_ID"]="2";
            dr["Score_Name"]="ระดับ 2";
            dt.Rows.Add(dr);

            dr=dt.NewRow();
            dr["Score_ID"]="3";
            dr["Score_Name"]="ระดับ 3";
            dt.Rows.Add(dr);

            dr=dt.NewRow();
            dr["Score_ID"]="4";
            dr["Score_Name"]="ระดับ 4";
            dt.Rows.Add(dr);

            dr=dt.NewRow();
            dr["Score_ID"]="5";
            dr["Score_Name"]="ระดับ 5";
            dt.Rows.Add(dr);

            ddl.ValueField = "Score_ID";
            ddl.TextField = "Score_Name";

            ddl.DataSource = dt;
            ddl.DataBind();

        }
        catch (Exception ex)
        {

        }
    }
    protected void SetDDLPERSON(ASPxComboBox ddl)
    {
        try
        {
            string sql = "";
            sql += " SELECT * FROM ( ";
            sql += "    select 0 ID,0 POS_ID,'เลือกผู้ขอประเมิน' PER_FULLNAME ";
            sql += "    UNION ";
            sql += "    select ID,POS_ID,PREFIX_NAME + NAME + ' ' + SURNAME PER_FULLNAME from vw_CMN_PERSON  ";
            sql += "    Where RETIRE_DATE>GetDate() AND PER_TYPE='11' AND POS_ID IS NOT NULL ";
            sql += "    AND POS_ID IN ( SELECT POS_ID  FROM PSST_POSITION  WHERE PER_TYPE='11' AND POS_STATUS=1 AND LENGTH_CODE LIKE 'K%')";
            sql += " ) AS TB ";
            sql += " order by ID + 0 ASC,PER_FULLNAME ";

            DataTable dt = new DataTable();
            dt = OPM_BL.GetDatatable(sql, null);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();
                ddl.Columns.Add("ID", "รหัสพนักงาน");
                ddl.Columns.Add("PER_FULLNAME", "ชื่อ - สกุล");

                ddl.ValueField = "ID";
                ddl.TextField = "PER_FULLNAME";

                ddl.DataSource = dt;
                ddl.DataBind();

                ddl.Columns[0].Width = 15;
                //ddl.SelectedIndex = 0;
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #35
0
    public static void Set_DDLORG_LV1_2(ASPxComboBox ddl)
    {
        try
        {
            string sql = "select * from (select 'A' as Group1 , ORG_SERIAL,ORG_NAME,ORG_ABBR from vw_SMM_ORG_LEVEL1 union " + Environment.NewLine;
            sql += "select 'B' as Group1 ,ORG_SERIAL,ORG_NAME,ORG_ABBR from vw_SMM_ORG_LEVEL2 ) as TB where 1=1" + Environment.NewLine;
            sql += "order by Group1,ORG_SERIAL";
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();

                ddl.ValueField = "ORG_SERIAL";
                ddl.TextField = "ORG_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #36
0
    public static void SetDDLPosition(ASPxComboBox ddl)
    {
        try
        {
            string sql = "select POS_ID,POS_NAME + '(' + POS_ID + ')' POS_NAME from vw_CMN_POSITION ";
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                ddl.ValueField = "POS_ID";
                ddl.TextField = "POS_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();

                ddl.SelectedIndex = 0;
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #37
0
    public static void SetDDLPerType(ASPxComboBox ddl)
    {
        try
        {
            //string sql = "select PER_TYPE,PER_TYPE_NAME from PSST_PER_TYPE where ORDER_SEQ is not null order by PER_TYPE";
            string sql = " SELECT SP.PER_TYPE ,PT.PER_TYPE_NAME"+Environment.NewLine;
            sql += " FROM SMM_PER_TYPE SP"+Environment.NewLine;
            sql += " INNER JOIN PSST_PER_TYPE PT ON SP.PER_TYPE=PT.PER_TYPE"+Environment.NewLine;
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                ddl.ValueField = "PER_TYPE";
                ddl.TextField = "PER_TYPE_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #38
0
 protected void FillSectionCombo(ASPxComboBox cmb, string country)
 {
     if (string.IsNullOrEmpty(country)) return;
     SectionObjectDS.SelectParameters[0].DefaultValue = country;
     cmb.DataBind();
 }
Example #39
0
    public static void SetDDLORGTYPE(ASPxComboBox ddl)
    {
        try
        {
            string sql = "select ORG_TYPE,ORG_TYPE_NAME from CTLT_ORGANIZE_TYPE";
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {

                ddl.ValueField = "ORG_TYPE";
                ddl.TextField = "ORG_TYPE_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #40
0
    public static void SetDDLSYSFORDPISRP(ASPxComboBox ddl)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("SYS_CODE");
        dt.Columns.Add("SYS_NAME");

        //DPIS=ชื่อดูใน ctlt_system
        //OPM=ระบบสารสนเทศ สปน.(เดิม)
        //OPM_BO=ระบบสารสนเทศ สปน.(ใหม่)

        DataRow row;
        row = dt.NewRow();
        row["SYS_CODE"] = "DPIS";
        row["SYS_NAME"] = "DPIS";
        dt.Rows.Add(row);

        row = dt.NewRow();
        row["SYS_CODE"] = "OPM";
        row["SYS_NAME"] = "OPM";
        dt.Rows.Add(row);

        row = dt.NewRow();
        row["SYS_CODE"] = "OPM_BO";
        row["SYS_NAME"] = "OPM_BO";
        dt.Rows.Add(row);

        row = dt.NewRow();
        row["SYS_CODE"] = "";
        row["SYS_NAME"] = "ทั้งหมด";
        dt.Rows.InsertAt(row, 0);

        //ddl.Columns.Clear();
        //ddl.Columns.Add("SYS_NAME", "ชื่อระบบ");
        //ddl.Columns.Add("SYS_CODE", "ชื่อย่อ");

        ddl.ValueField = "SYS_CODE";
        ddl.TextField = "SYS_NAME";

        ddl.DataSource = dt;
        ddl.DataBind();
    }
    protected void SetDDLPOSITION(ASPxComboBox ddl, string PER_TYPE)
    {
        try
        {
            string sql = "SELECT DISTINCT POS.POS_ID,ISNULL(AM.ADMIN_NAME,LC.LINE_NAME) POS_NAME,ORG.ORG_NAME + ' (' + ORG.ORG_ABBR + ')' ORG_NAME";
            sql += " FROM vw_SMM_ORG ORG ";
            sql += " LEFT JOIN PSST_POSITION POS ON ORG.ORG_SERIAL=POS.ORG_SERIAL";
            sql += " AND POS.POS_STATUS IN (1,2)";
            sql += " LEFT JOIN PSST_LINE_CODE LC ON POS.LINE_CODE=LC.PL_CODE";
            sql += " LEFT JOIN PSST_ADMIN_CODE AM ON POS.ADMIN_CODE=AM.ADMIN_CODE";
            sql += " WHERE ISNULL(AM.ADMIN_NAME,LC.LINE_NAME) IS NOT NULL AND POS.PER_TYPE=@_PER_TYPE";
            sql += " ORDER BY POS.POS_ID";

            SqlParameter[] param = new SqlParameter[1];
            param[0] = OPM_BL.setParameter("@_PER_TYPE", SqlDbType.VarChar, PER_TYPE);
            DataTable dt = new DataTable();
            dt = OPM_BL.GetDatatable(sql, param);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();
                ddl.Columns.Add("POS_ID", "เลขตำแหน่ง");
                ddl.Columns.Add("POS_NAME", "ชื่อตำแหน่ง");
                ddl.Columns.Add("ORG_NAME", "หน่วยงาน");

                ddl.ValueField = "POS_ID";
                ddl.TextField = "POS_NAME";

                ddl.Columns[0].Width = 15;
                ddl.DataSource = dt;
                ddl.DataBind();

                //ddl.SelectedIndex = 0;
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #42
0
    public static void SetDDLORGL3(ASPxComboBox ddl)
    {
        try
        {
            string sql = "SELECT ORG_SERIAL,ORG_NAME,ORG_ABBR FROM vw_SMM_ORG WHERE ORG_LEVEL IN(3) order by ORG_NAME";
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            DataRow row;
            row = dt.NewRow();
            //row["ORG_SERIAL"] = "0";
            //row["ORG_NAME"] = "--ALL--";
            //row["ORG_ABBR"] = "";
            //dt.Rows.InsertAt(row, 0);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();
                ddl.Columns.Add("ORG_NAME", "ชื่อหน่วยงาน");
                //ddl.Columns.Add("ORG_ABBR", "ชื่อย่อ");

                ddl.ValueField = "ORG_SERIAL";
                ddl.TextField = "ORG_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #43
0
    public static void SetDDLPERSONBYPERTYPE(ASPxComboBox ddl, string per_type, bool IsAll = false)
    {
        try
        {
            string sql = " select ID,PREFIX_NAME + NAME + ' ' + SURNAME PER_FULLNAME   ";
            sql += " from vw_CMN_PERSON  ";
            sql += " where name is not null and  per_type='" + per_type + "'  ";
            sql += " AND RETIRE_DATE>GetDate() ";
            sql += " AND ID IN ( SELECT ID  FROM PSST_POSITION  WHERE PER_TYPE='" + per_type  + "' AND POS_STATUS=1 AND LENGTH_CODE LIKE 'K%') ";
            sql += " order by name,surname ";

            //string sql = "select ID,PREFIX_NAME + NAME + ' ' + SURNAME PER_FULLNAME  from vw_CMN_PERSON ";
            //sql += " where name is not null and  per_type='" + per_type + "' order by name,surname";

            DataTable dt = new DataTable();
            dt = OPM_BL.GetDatatable(sql, null);

            if (dt.Rows.Count > 0)
            {
                //ddl.Columns.Clear();
                //ddl.Columns.Add("ID", "เลขที่");
                //ddl.Columns.Add("PER_FULLNAME", "ชื่อ");

                if (IsAll == true)
                {
                    DataRow dr = dt.NewRow();
                    dr["ID"] = "0";
                    dr["PER_FULLNAME"] = "ทั้งหมด";
                    dt.Rows.InsertAt(dr, 0);
                }

                ddl.ValueField = "ID";
                ddl.TextField = "PER_FULLNAME";

                ddl.DataSource = dt;
                ddl.DataBind();

                //ddl.SelectedIndex = 0;
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #44
0
    public static void SetDDLBudgetYear(ASPxComboBox ddl)
    {
        try
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("budget_year_value");
            dt.Columns.Add("budget_year_display");

            int startYear = DateTime.Now.AddYears(-10).Year;
            for (int i = startYear; i <= (DateTime.Now.Year + 1); i++)
            {
                DataRow dr = dt.NewRow();
                dr["budget_year_value"] = (i + 543).ToString();
                dr["budget_year_display"] = (i + 543).ToString();
                dt.Rows.Add(dr);
            }

            if (dt.Rows.Count > 0)
            {
                ddl.ValueField = "budget_year_value";
                ddl.TextField = "budget_year_display";

                ddl.DataSource = dt;
                ddl.DataBind();
                ddl.Value = setBudgetYear(DateTime.Now);
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #45
0
    public static void SetDDLPerTypeISMAIN1(ASPxComboBox ddl, bool isAll = false)
    {
        try
        {
            string sql = "select PER_TYPE,PER_TYPE_NAME from SMM_PER_TYPE Where IS_MAIN =1 ORDER BY PER_TYPE_NAME";

            DataTable dt = GetDatatable(sql, null);
            if (dt.Rows.Count > 0)
            {
                if (isAll == true)
                {
                    DataRow dr = dt.NewRow();
                    dr["PER_TYPE"] = "0";
                    dr["PER_TYPE_NAME"] = "ทั้งหมด";
                    dt.Rows.InsertAt(dr, 0);
                }

                ddl.ValueField = "PER_TYPE";
                ddl.TextField = "PER_TYPE_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #46
0
    public static void SetDDLChartType(ASPxComboBox ddl)
    {
        try
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("ID");
            dt.Columns.Add("name");

            DataRow dr;
            dr = dt.NewRow();
            dr["id"] = "1";
            dr["name"] = "กราฟแท่ง";
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr["id"] = "2";
            dr["name"] = "กราฟเส้น";
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr["id"] = "3";
            dr["name"] = "กราฟวงกลม";
            dt.Rows.Add(dr);

            if (dt.Rows.Count > 0)
            {
                ddl.ValueField = "ID";
                ddl.TextField = "name";

                ddl.DataSource = dt;
                ddl.DataBind();

                ddl.SelectedIndex = 0;
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #47
0
    // แสดงชื่อตำแหน่งของลูกจ้างโครงการ ไกท์ไลน์
    public static void SetDDLPositionNameOtherType(ASPxComboBox ddl)
    {
        try
        {
            string sql = "";
             sql += " SELECT  ROW_NUMBER() OVER(ORDER BY LINE_INORG ASC) AS Row,LINE_INORG FROM ( ";
             sql += "   SELECT DISTINCT  LINE_INORG  FROM PSST_POSITION  WHERE PER_TYPE in ('23','Z0') AND POS_Status=1 AND LINE_INORG IS NOT NULL  ";
             sql += " )AS TB ORDER BY LINE_INORG ";

            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();
                ddl.Columns.Add("LINE_INORG", "ตำแหน่ง");

                ddl.ValueField = "Row";
                ddl.TextField = "LINE_INORG";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #48
0
    public static void SetDDLJDEVALITEM(ASPxComboBox ddl, int TypeID)
    {
        try
        {
            string sql = "select * from SMM_JD_EVAL_ITEM where TYPE_ID=" + TypeID;
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                ddl.ValueField = "ITEM_ID";
                ddl.TextField = "ITEM_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #49
0
    public static void Set_DDLORG_LV3_BY_LV1_2(ASPxComboBox ddl, string wh)
    {
        try
        {
            string sql = "select ORG_SERIAL,ORG_NAME,ORG_ABBR from vw_SMM_ORG_LEVEL3 where 1=1 ";
            if (wh != "76") { sql += " AND UPPER_ORG_SERIAL = " + wh; }
            sql += " Order by ORG_SERIAL";
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();

                ddl.ValueField = "ORG_SERIAL";
                ddl.TextField = "ORG_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
            else
            {
                ddl.Columns.Clear();

                ddl.ValueField = "ORG_SERIAL";
                ddl.TextField = "ORG_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
    protected void SetDDLLEVEL(ASPxComboBox ddl, string POS_ID, string PER_TYPE)
    {
        try
        {
            string sql = "";
            //sql += " declare @LENGTH_CODE varchar(10);";
            //sql += " SET @LENGTH_CODE = (select length_code from PSST_POSITION where POS_ID =@_POS_ID AND PER_TYPE=@_PER_TYPE)";
            //sql += " SELECT CUR_LEV,LEVEL_NAME  ";
            //sql += " FROM PSST_PER_LEVEL";
            //sql += " WHERE CUR_LEV>11";
            //sql += " AND CUR_LEV between (select LENGTH_MIN from PSST_LENGTH_CODE WHERE LENGTH_CODE =@LENGTH_CODE)";
            //sql += " AND (select LENGTH_MAX from PSST_LENGTH_CODE WHERE LENGTH_CODE =@LENGTH_CODE)";

                sql = "";

                sql += " declare @LENGTH_CODE varchar(10);";
                sql += " SET @LENGTH_CODE = (select length_code from PSST_POSITION where POS_ID =@_POS_ID AND PER_TYPE=@_PER_TYPE)"; sql += " select CUR_LEV ,LEVEL_NAME  \n";
                sql += " FROM  PSST_PER_LEVEL   \n";
                sql += " WHERE CUR_LEV>11";
                sql += " AND CUR_LEV between (select LENGTH_MIN from PSST_LENGTH_CODE WHERE LENGTH_CODE =@LENGTH_CODE)";
                sql += " AND (select LENGTH_MAX from PSST_LENGTH_CODE WHERE LENGTH_CODE =@LENGTH_CODE)";

            SqlParameter[] param = new SqlParameter[2];
            param[0] = OPM_BL.setParameter("@_POS_ID", SqlDbType.VarChar, POS_ID);
            param[1] = OPM_BL.setParameter("@_PER_TYPE", SqlDbType.VarChar, PER_TYPE);
            DataTable dt = new DataTable();
            dt = OPM_BL.GetDatatable(sql, param);

            if (dt.Rows.Count == 0)
            {
                // กรณี ข้อมูล LENGTH CODE ว่าง แต่มี CUR_LEVEL
                sql = "";
                sql += " select CUR_LEV ,LEVEL_NAME  \n";
                sql += " FROM  PSST_PER_LEVEL   \n";
                sql += " WHERE CUR_LEV =(SELECT CUR_LEV from PSST_POSITION WHERE POS_ID=@_POS_ID AND PER_TYPE =@_PER_TYPE )  ";

                param = new SqlParameter[2];
                param[0] = OPM_BL.setParameter("@_POS_ID", SqlDbType.VarChar, POS_ID);
                param[1] = OPM_BL.setParameter("@_PER_TYPE", SqlDbType.VarChar, PER_TYPE);

                dt = new DataTable();
                dt = OPM_BL.GetDatatable(sql, param);
                ddl.ValueField = "CUR_LEV";
                ddl.TextField = "LEVEL_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
                ddl.SelectedIndex = 0;
            }
            else {
            ddl.ValueField = "CUR_LEV";
            ddl.TextField = "LEVEL_NAME";

            ddl.DataSource = dt;
            ddl.DataBind();
            ddl.SelectedIndex = 0;
            }

        }
        catch (Exception ex)
        {

        }
    }
Example #51
0
    public static void SetDDLPerType(ASPxComboBox ddl, bool isAll = true)
    {
        try
        {
            //string sql = "SELECT DISTINCT * FROM " + Environment.NewLine;
            //sql += " (SELECT PER_TYPE,PER_TYPE_NAME" + Environment.NewLine;
            //sql += " FROM PSST_PER_TYPE" + Environment.NewLine;
            //sql += " WHERE DEC_FLAG ='Y'" + Environment.NewLine;
            //sql += " UNION ALL" + Environment.NewLine;
            //sql += " SELECT SP.PER_TYPE ,PT.PER_TYPE_NAME" + Environment.NewLine;
            //sql += " FROM SMM_PER_TYPE SP" + Environment.NewLine;
            //sql += " INNER JOIN PSST_PER_TYPE PT ON SP.PER_TYPE=PT.PER_TYPE" + Environment.NewLine;
            //sql += " WHERE IS_MAIN=0 " + Environment.NewLine;
            //sql += " ) AS PER_TYPE";

            string sql = "SELECT SP.PER_TYPE ,PT.PER_TYPE_NAME" + Environment.NewLine;
            sql += " FROM SMM_PER_TYPE SP" + Environment.NewLine;
            sql += " INNER JOIN PSST_PER_TYPE PT ON SP.PER_TYPE=PT.PER_TYPE" + Environment.NewLine;

            DataTable dt = GetDatatable(sql, null);
            if (dt.Rows.Count > 0)
            {
                if (isAll == true)
                {
                    DataRow dr = dt.NewRow();
                    dr["PER_TYPE"] = "";
                    dr["PER_TYPE_NAME"] = "ทั้งหมด";
                    dt.Rows.InsertAt(dr, 0);
                }

                ddl.ValueField = "PER_TYPE";
                ddl.TextField = "PER_TYPE_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #52
0
    public static void SetDDLSYS(ASPxComboBox ddl, bool IsAddAll)
    {
        try
        {
            string sql = "select SYS_CODE ,SYS_NAME,SYS_URL,IS_EXTERNAL from ODS_SYSTEM ";
            sql += " Where IS_EXTERNAL = 0  Order by SYS_NAME,SYS_CODE";
            SqlDataAdapter da = new SqlDataAdapter(sql, StaticDefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            if (IsAddAll == true)
            {
                DataRow row;
                row = dt.NewRow();
                row["SYS_CODE"] = "";
                row["SYS_NAME"] = "ทั้งหมด";
                dt.Rows.InsertAt(row, 0);
            }

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();
                ddl.Columns.Add("SYS_NAME", "ชื่อหน่วยงาน");
                ddl.Columns.Add("SYS_CODE", "ชื่อย่อ");

                ddl.ValueField = "SYS_CODE";
                ddl.TextField = "SYS_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #53
0
    public static void SetDDLPOSTYPE(ASPxComboBox ddl)
    {
        try
        {
            string sql = "select POS_TYPE,POS_TYPE_NAME from PSST_POS_TYPE order by POS_TYPE_NAME";
            DataTable dt = GetDatatable(sql, null);

            if (dt.Rows.Count > 0)
            {
                ddl.ValueField = "POS_TYPE";
                ddl.TextField = "POS_TYPE_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
    protected void SetDDLPERSON(ASPxComboBox ddl)
    {
        try
        {
            //string sql = "SELECT ID,PREFIX_NAME + PER.NAME + ' ' + PER.SURNAME PER_FULLNAME ";
            //sql += " FROM PSST_PERSON PER ";
            //sql += " INNER JOIN CTLT_PREFIX_CODE PF ON PER.PREFIX_CODE=PF.PREFIX_CODE";
            //sql += " WHERE PER_STATUS='1' AND RETIRE_DATE>GetDate() AND PER_TYPE=11 ORDER BY PER.NAME,PER.SURNAME";

            string sql = "select ID,PREFIX_NAME + NAME + ' ' + SURNAME PER_FULLNAME  from vw_CMN_PERSON ";
             sql += " Where RETIRE_DATE>GetDate() AND PER_TYPE=11 AND POS_ID IS NOT NULL";
             sql += " order by name,surname";

            DataTable dt = new DataTable();
            dt = OPM_BL.GetDatatable(sql, null);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();
                ddl.Columns.Add("ID", "เลขที่");
                ddl.Columns.Add("PER_FULLNAME", "ชื่อ");

                ddl.ValueField = "ID";
                ddl.TextField = "PER_FULLNAME";

                ddl.DataSource = dt;
                ddl.DataBind();

                //ddl.SelectedIndex = 0;
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #55
0
    public static void Set_DDLORG_LV3(ASPxComboBox ddl)
    {
        try
        {
            string sql = "select ORG_SERIAL,ORG_NAME,ORG_ABBR from vw_SMM_ORG_LEVEL2 order by ORG_SERIAL";
            SqlDataAdapter da = new SqlDataAdapter(sql, DefaultConnectionString);
            DataTable dt = new DataTable();
            da.Fill(dt);

            DataRow row;
            row = dt.NewRow();
            row["ORG_NAME"] = "ทั้งหมด";
            dt.Rows.InsertAt(row, 0);

            if (dt.Rows.Count > 0)
            {
                ddl.Columns.Clear();

                ddl.ValueField = "ORG_SERIAL";
                ddl.TextField = "ORG_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #56
0
        public void InstantiateIn(Control container)
        {
            Control control = new Control();
            control.ID = "GroupDetectorEditForm";
            container.Controls.Add(control);
            
            DataTable dt = datafield;
            string db_name = "";
            string desc_name = "";
            string auth = "";
            string cell_type = "";

            ASPxFormLayout editform_GroupDetector = new ASPxFormLayout();
            editform_GroupDetector.ID = "editform_GroupDetector";
            //editform_GroupDetector.Border.BorderWidth = Unit.Pixel(1);
            //editform_GroupDetector.SettingsItems.VerticalAlign = FormLayoutVerticalAlign.Middle;
            //editform_GroupDetector.SettingsItems.HorizontalAlign = FormLayoutHorizontalAlign.Center;
            editform_GroupDetector.Paddings.Padding = Unit.Pixel(8);
            
            
            foreach (DataRow dr in dt.Select("AUTH <> 'System'", "VIEW_SEQ"))
            {
                db_name = dr["DB_NAME"].ToString();
                desc_name = dr["DESC_NAME"].ToString();
                auth = dr["AUTH"].ToString();
                cell_type = dr["SEL_TYPE"].ToString();
                

                LayoutItem li = new LayoutItem(desc_name);
                li.FieldName = db_name;
                
                editform_GroupDetector.Items.Add(li);
                LayoutItemNestedControlContainer li_container = li.LayoutItemNestedControlContainer;
                if (auth == "Manager")
                {
                    li.CaptionStyle.Font.Bold = true;
                    li.CaptionStyle.ForeColor = Color.Red;
                }


                if (cell_type == "DropDown List")
                {
                    ASPxDropDownEdit dropdownEdit = new ASPxDropDownEdit();
                    dropdownEdit.ID = db_name;

                    ASPxComboBox comboBox = new ASPxComboBox();
                    comboBox.DataSource = Srch_DropDownItem(db_name);
                    comboBox.TextField = "LOOKUPDETDESC";
                    comboBox.DataBind();
                    comboBox.IncrementalFilteringMode = IncrementalFilteringMode.StartsWith;
                    comboBox.DropDownStyle = DropDownStyle.DropDown;
                    comboBox.EnableSynchronization = DevExpress.Utils.DefaultBoolean.False;
                    li_container.Controls.Add(comboBox);
                }
                else if (cell_type == "Note")
                {
                    ASPxMemo textMemo = new ASPxMemo();
                    textMemo.ID = db_name;
                    textMemo.Width = Unit.Percentage(91);
                    li_container.Controls.Add(textMemo);
                }
                else
                {
                    
                    ASPxTextBox textBox = new ASPxTextBox();
                    textBox.ID = db_name;
                    li_container.Controls.Add(textBox);


                    //Suffix 증가 유무 체크 (15.10.16)
                    if (db_name == "CNT")
                    {
                        li = new LayoutItem("Suffix");
                        li.FieldName = "DETECTOR_SUFFIX";

                        editform_GroupDetector.Items.Add(li);
                        li_container = li.LayoutItemNestedControlContainer;

                        ASPxCheckBox chkBox = new ASPxCheckBox();
                        chkBox.ID = "DETECTOR_SUFFIX";
                        li_container.Controls.Add(chkBox);
                    }

                }
                
            }
            

            container.Controls.Add(editform_GroupDetector);
            //container.Controls.Add(editform_GroupDetector);
            
            //Button
            ASPxFormLayout btn_lo = new ASPxFormLayout();
            btn_lo.ID = "button_GroupDetector";
            btn_lo.ColCount = 1;
            btn_lo.Width = Unit.Percentage(90);
            btn_lo.SettingsItems.HorizontalAlign = FormLayoutHorizontalAlign.Right;
            btn_lo.Paddings.Padding = Unit.Pixel(1);

            LayoutItem btn_li = new LayoutItem("btn_li");
            btn_li.ShowCaption = DevExpress.Utils.DefaultBoolean.False;
            btn_lo.Items.Add(btn_li);
            LayoutItemNestedControlContainer btn_li_container = btn_li.LayoutItemNestedControlContainer;

            ASPxGridViewTemplateReplacement btn_add = new ASPxGridViewTemplateReplacement();
            btn_add.ReplacementType = GridViewTemplateReplacementType.EditFormUpdateButton;
            btn_add.ID = "btn_add";
            btn_li_container.Controls.Add(btn_add);

            //LayoutItem btn_li2 = new LayoutItem("btn_li2");
            //btn_li2.ShowCaption = DevExpress.Utils.DefaultBoolean.False;
            //btn_lo.Items.Add(btn_li2);
            //LayoutItemNestedControlContainer btn_li_container2 = btn_li2.LayoutItemNestedControlContainer;

            ASPxGridViewTemplateReplacement btn_cancel = new ASPxGridViewTemplateReplacement();
            btn_cancel.ReplacementType = GridViewTemplateReplacementType.EditFormCancelButton;
            btn_cancel.ID = "btn_cancel";
            btn_li_container.Controls.Add(btn_cancel);
            //btn_li.HorizontalAlign = FormLayoutHorizontalAlign.Right;

            container.Controls.Add(btn_lo);
        }
Example #57
0
    public static void SetDDL_PER_LEVEL_NAME(ASPxComboBox ddl, string group_name,string per_type)
    {
        try
        {
            string sql = "select CUR_LEV,LEVEL_GROUP_NAME,LEVEL_NAME from  PSST_PER_LEVEL  where 1=1 " + Environment.NewLine;
            sql += " and PER_TYPE = '" + per_type + "'";
            if (!string.IsNullOrEmpty(group_name))
            {
                sql += " and LEVEL_GROUP_NAME = '" + group_name + "'";
            }

            DataTable dt = GetDatatable(sql, null);

            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.NewRow();
                dr["LEVEL_NAME"] = "";
                dt.Rows.InsertAt(dr, 0);

                ddl.ValueField = "CUR_LEV";
                ddl.TextField = "LEVEL_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #58
0
    public static void Show_SetDDLTimeRule(ASPxComboBox ddl)
    {
        try
        {
            string sql = "select time_code,time_name from PSST_TIME_RULE where TIME_STATUS=1 order by TIME_NAME";
            DataTable dt = GetDatatable(sql, null);
            if (dt.Rows.Count > 0)
            {

                DataRow dr = dt.NewRow();
                dr["time_code"] = "";
                dr["time_name"] = "";
                dt.Rows.InsertAt(dr, 0);

                ddl.ValueField = "time_code";
                ddl.TextField = "time_name";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #59
0
    public static void SetDDLRemark(ASPxComboBox ddl, bool IsAll = false)
    {
        //กำหนดค่าให้กับ Dropdownlist หมายเหตุการลงเวลา
        try
        {
            //string sql = "select distinct remarks id,remarks from HRM_TIME_PROCESS where remarks is not null order by remarks ";
            string sql = "select LEAVE_ID,LEAVE_NAME from PDM_MS_LEAVE where LEAVE_TYPE_ID = 2";
            DataTable dt = GetDatatable(sql, null);
            if (dt.Rows.Count > 0)
            {
                if (IsAll == true)
                {
                    DataRow dr = dt.NewRow();
                    dr["LEAVE_ID"] = "0";
                    dr["LEAVE_NAME"] = "ทั้งหมด";
                    dt.Rows.InsertAt(dr, 0);
                }

                ddl.ValueField = "LEAVE_ID";
                ddl.TextField = "LEAVE_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }
Example #60
0
    public static void SetDDL_PosType(ASPxComboBox ddl)
    {
        try
        {
            string sql = "select LEVEL_GROUP_NAME,min(cur_lev) as cur_lev from  PSST_PER_LEVEL where PER_TYPE='11' and LEVEL_GROUP_NAME is not null group by LEVEL_GROUP_NAME order by CUR_LEV";
            DataTable dt = GetDatatable(sql, null);

            if (dt.Rows.Count > 0)
            {
                ddl.ValueField = "LEVEL_GROUP_NAME";
                ddl.TextField = "LEVEL_GROUP_NAME";

                ddl.DataSource = dt;
                ddl.DataBind();
            }
        }
        catch (Exception ex)
        {

        }
    }