예제 #1
0
파일: UserAccounts.cs 프로젝트: HCMISFE/FE
        /// <summary>
        /// Populates user related info
        /// </summary>
        private void PopulateUser()
        {
            User      us     = new User();
            DataTable dtUser = us.GetUsers();
            int       count  = 1;
            int       col    = 0;

            lstUsers.Items.Clear();
            foreach (DataRow dv in dtUser.Rows)
            {
                string[]     str = { count.ToString(), dv["FullName"].ToString(), dv["Mobile"].ToString(), dv["UserName"].ToString(), dv["Type"].ToString() };
                ListViewItem lst = new ListViewItem(str)
                {
                    Tag = dv["ID"]
                };
                if (col != 0)
                {
                    lst.BackColor = Color.FromArgb(233, 247, 248);
                    col           = 0;
                }
                else
                {
                    col++;
                }
                lstUsers.Items.Add(lst);
                count++;
            }

            UserType uType = new UserType();

            uType.LoadAll();
            cboUserType.DataSource = uType.DefaultView;

            BLL.Type comUser = new BLL.Type();
            comUser.LoadAll();
            cbCommodity.Properties.DataSource    = comUser.DefaultView;
            cbCommodity.Properties.DisplayMember = "Name";
            cbCommodity.Properties.ValueMember   = "ID";

            Stores storeUser = new Stores();

            storeUser.LoadAll();
            cbStore.Properties.DataSource    = storeUser.DefaultView;
            cbStore.Properties.DisplayMember = "StoreName";
            cbStore.Properties.ValueMember   = "ID";
        }
예제 #2
0
        /// <summary>
        /// Populates lookups and tables
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SystemSetting_Load(object sender, EventArgs e)
        {
            PopulatePrograms();
            // TAb IIN
            BLL.INN innInfo = new INN();
            innInfo.LoadAll();
            innInfo.Sort = "IIN";
            PopulateINN(innInfo);

            // TAb Category

            BLL.Type type = new BLL.Type();
            type.LoadAll();
            lkCategory.DataSource = type.DefaultView;

            PopulateCategoryTree();
            //unit section
            BLL.Unit uni = new Unit();
            uni.LoadAll();
            lstUnits.DataSource = uni.DefaultView;

            // dosage form section
            DosageForm doForm = new DosageForm();

            doForm.LoadAll();
            doForm.Sort = "Form";
            PopulateDosageForm(doForm);
            //receiving status section
            // PopulateManufacturer();
            //disposal reasons
            DisposalReasons reason = new DisposalReasons();

            reason.LoadAll();
            reason.Sort = "Reason";
            PopulateDisposalReason(reason);
            //location regions zones and woredas
            PopulateLocationTree();
            PopulateSupplyCatTree();

            PopulateBalance();
        }
예제 #3
0
파일: UserAccounts.cs 프로젝트: HCMISFE/FE
        /// <summary>
        /// Update the form based on the selected user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lstUsers_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstUsers.SelectedItems.Count > 0)
            {
                int  selected = Convert.ToInt32(lstUsers.SelectedItems[0].Tag);
                User us       = new User();
                us.LoadByPrimaryKey(selected);
                txtFullName.Text          = us.FullName;
                txtAddress.Text           = us.Address;
                txtMobile.Text            = us.Mobile;
                ckActive.Checked          = us.Active;
                cboUserType.SelectedValue = us.UserType.ToString();
                _userId = us.ID;
                grpLoginInfo.Enabled = false;

                BLL.Type ucType = new BLL.Type();
                ucType.LoadAll();

                UserCommodityType usc     = new UserCommodityType();
                DataTable         comUser = usc.GetUserCommodityType(_userId);

                cbCommodity.Properties.DataSource    = ucType.DefaultView.ToTable();
                cbCommodity.Properties.DisplayMember = "Name";
                cbCommodity.Properties.ValueMember   = "ID";
                string[] arr   = new string[comUser.DefaultView.ToTable().Rows.Count];
                int      index = 0;
                foreach (DataRow dr in comUser.DefaultView.ToTable().Rows)
                {
                    arr[index] = Convert.ToString(dr["ID"]);
                    index++;
                }
                char   separator = cbCommodity.Properties.SeparatorChar;
                string result    = string.Empty;
                foreach (var element in arr)
                {
                    result += element + separator;
                }
                cbCommodity.SetEditValue(result);

                UserStore ust       = new UserStore();
                DataTable storeUser = ust.GetUserStore(_userId);
                Stores    stuser    = new Stores();
                stuser.LoadAll();
                cbStore.Properties.DataSource    = stuser.DefaultView;
                cbStore.Properties.DisplayMember = "StoreName";
                cbStore.Properties.ValueMember   = "ID";
                string[] arrst    = new string[storeUser.DefaultView.ToTable().Rows.Count];
                int      rowindex = 0;
                foreach (DataRow drs in storeUser.DefaultView.ToTable().Rows)
                {
                    arrst[rowindex] = Convert.ToString(drs["ID"]);
                    rowindex++;
                }
                char   separatorst = cbStore.Properties.SeparatorChar;
                string resultst    = string.Empty;
                foreach (var element in arrst)
                {
                    resultst += element + separatorst;
                }
                cbStore.SetEditValue(resultst);
            }
        }
예제 #4
0
 public DataTable GetAllCategory()
 {
     BLL.Type type = new Type();
     type.LoadAll();
     return(type.DataTable);
 }
예제 #5
0
 public static DataTable GetAllTypes()
 {
     BLL.Type type = new Type();
     type.LoadAll();
     return(type.DataTable);
 }
        /// <summary>
        /// Populates lookups and tables
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SystemSetting_Load(object sender, EventArgs e)
        {
            PopulatePrograms();
            // TAb IIN
            BLL.INN innInfo = new INN();
            innInfo.LoadAll();
            innInfo.Sort = "IIN";
            PopulateINN(innInfo);

            // TAb Category

            BLL.Type type = new BLL.Type();
            type.LoadAll();
            lkCategory.DataSource = type.DefaultView;

            PopulateCategoryTree();
            //unit section
            BLL.Unit uni = new Unit();
            uni.LoadAll();
            lstUnits.DataSource = uni.DefaultView;

            // dosage form section
            DosageForm doForm = new DosageForm();
            doForm.LoadAll();
            doForm.Sort = "Form";
            PopulateDosageForm(doForm);
            //receiving status section
            // PopulateManufacturer();
            //disposal reasons
            DisposalReasons reason = new DisposalReasons();
            reason.LoadAll();
            reason.Sort = "Reason";
            PopulateDisposalReason(reason);
            //location regions zones and woredas
            PopulateLocationTree();
            PopulateSupplyCatTree();

            PopulateBalance();
        }