Beispiel #1
0
        public List <StoreModels> GetListStoreForTransfer()
        {
            List <StoreModels> ListStore = new List <StoreModels>();

            try
            {
                StoreFactory   _storeFactory      = new StoreFactory();
                CompanyFactory _companyFactory    = new CompanyFactory();
                List <string>  listOrganizationId = new List <string>();
                if (CurrentUser != null)
                {
                    listOrganizationId = CurrentUser.ListOrganizationId;
                }
                _storeFactory   = new StoreFactory();
                _companyFactory = new CompanyFactory();
                ListStore       = _storeFactory.GetListStoreForTranfer(listOrganizationId);
                if (ListStore == null)
                {
                    ListStore = new List <StoreModels>();
                }
                //ListStore = ListStore.Where(x => CurrentUser.ListStoreID.Contains(x.Value)).ToList();
            }
            catch (Exception)
            {
            }
            return(ListStore);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            //try
            //{
            PharmacyDbContext db = new PharmacyDbContext();

            foreach (ListViewItem item in lvMedicine.Items)
            {
                Medicine medicine = new Medicine();

                medicine.Name        = item.SubItems[2].Text;
                medicine.Id          = UniqueNumber.GenerateUniqueNumber();
                medicine.CreatedBy   = currentUser;
                medicine.CreatedDate = DateTime.Now;
                medicine.GroupId     = GroupFactory.GetGroupId(item.SubItems[3].Text, currentUser);
                medicine.CompanyId   = CompanyFactory.GetCompanyId(item.SubItems[4].Text, currentUser);
                db.Medicine.Add(medicine);
            }
            db.SaveChanges();
            db.Dispose();
            MessageBox.Show(@"Save successful!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            lvMedicine.Items.Clear();
            //}
            //catch (Exception exception)
            //{
            //    MessageBox.Show("Saving Error:" + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
        }
Beispiel #3
0
        public void search()
        {
            List <tblCompany> list = CompanyFactory.getTopCompany(txtCompanyName.Text.Trim(), txtCompanyCode.Text.Trim());

            grvCompany.AutoGenerateColumns = false;
            grvCompany.DataSource          = list;
        }
Beispiel #4
0
        public frmReLogin()
        {
            InitializeComponent();
            this.FormClosing       += new FormClosingEventHandler(frmReLogin_FormClosing);
            comboBox1.DisplayMember = "COMPANY_NAME";
            comboBox1.ValueMember   = "COMPANY_CODE";

            comboBox2.DisplayMember = "PLINE_NAME";
            comboBox2.ValueMember   = "RMES_ID";

            comboBox3.DisplayMember = "STATION_NAME";
            comboBox3.ValueMember   = "RMES_ID";

            comboBox4.DisplayMember = "SHIFT_NAME";
            comboBox4.ValueMember   = "RMES_ID";

            comboBox5.DisplayMember = "TEAM_NAME";
            comboBox5.ValueMember   = "RMES_ID";

            comboBox1.DataSource = CompanyFactory.GetAll();
            string _companycode = DB.ReadConfigLocal("COMPANY_CODE");

            if (!_companycode.Equals(string.Empty))
            {
                comboBox1.SelectedValue = _companycode;
                CompanyEntity company = CompanyFactory.GetByKey(_companycode);
                if (company != null)
                {
                    LoginInfo.CompanyInfo = company;
                    initComboBoxByCompany();
                }
            }
            initing = false;
        }
Beispiel #5
0
        private void FrmAddCompany_Load(object sender, EventArgs e)
        {
            if (_mode == 0) //add new
            {
                this.Text         = "Them moi doanh nghiep" + ConstantInfo.MESSAGE_TITLE + GlobalInfo.CompanyName;
                btnAdd.Enabled    = true;
                btnUpdate.Enabled = false;
            }

            if (_mode == 1) //update
            {
                btnAdd.Enabled    = false;
                btnUpdate.Enabled = true;

                this.Text = "Cap nhat doanh nghiep" + ConstantInfo.MESSAGE_TITLE + GlobalInfo.CompanyName;
                tblCompany company = CompanyFactory.FindByCode(_companyCode);
                if (company == null)
                {
                    MessageBox.Show("Doanh nghiệp này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                txtCompanyCode.ReadOnly = true;
                txtCompanyCode.Text     = company.CompanyCode;
                txtCompanyName.Text     = company.CompanyName;
                txtDescription.Text     = company.Description;
            }
        }
Beispiel #6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.grvCompany.SelectedRows.Count > 0)
                {
                    int selectedIndex = grvCompany.SelectedRows[0].Index;

                    // gets the RowID from the first column in the grid
                    var companyCode = grvCompany[0, selectedIndex].Value.ToString();

                    tblCompany company = CompanyFactory.FindByCode(companyCode);
                    if (company == null)
                    {
                        MessageBox.Show("Doanh nghiệp này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    FrmAddCompany frmAddCompany = new FrmAddCompany(companyCode, 1, _userInfo, this);
                    frmAddCompany.MdiParent = this.MdiParent;
                    frmAddCompany.Show();
                }
                else
                {
                    MessageBox.Show("Bạn cần chọn một bản ghi để cập nhật", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                if (GlobalInfo.IsDebug)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            ICompany company1 = CompanyFactory.GetCompany(Company.Company1);

            company1.TurnOn();
            var company1PersonelList = company1.PersonelList();

            company1PersonelList.ForEach(i => Console.Write($"{Environment.NewLine}{i}"));
            Console.WriteLine(Environment.NewLine);


            ICompany company2 = CompanyFactory.GetCompany(Company.Company2);

            company2.TurnOn();
            var company2PersonelList = company2.PersonelList();

            company2PersonelList.ForEach(i => Console.Write($"{Environment.NewLine}{i}"));
            Console.WriteLine(Environment.NewLine);

            ICompany company3 = CompanyFactory.GetCompany(Company.Company3);

            company3.TurnOn();
            var company3PersonelList = company3.PersonelList();

            company3PersonelList.ForEach(i => Console.Write($"{Environment.NewLine}{i}"));
            Console.WriteLine();

            Console.ReadLine();
        }
Beispiel #8
0
        public List <SelectListItem> GetListStore()
        {
            List <SelectListItem> ListStore = new List <SelectListItem>();

            try
            {
                StoreFactory   _storeFactory      = new StoreFactory();
                CompanyFactory _companyFactory    = new CompanyFactory();
                List <string>  listOrganizationId = new List <string>();
                if (CurrentUser != null)
                {
                    listOrganizationId = CurrentUser.ListOrganizationId;
                }
                _storeFactory = new StoreFactory();
                //_companyFactory = new CompanyFactory();
                ListStore = _storeFactory.GetListStore(listOrganizationId);
                //ListStore = _storeFactory.GetListStore(_companyFactory.GetListCompany(listOrganizationId));
                /*Editor by trongntn 06-01-2017*/
                ListStore = ListStore.Where(x => CurrentUser.ListStoreID.Contains(x.Value)).ToList();
            }
            catch (Exception)
            {
            }
            return(ListStore);
        }
Beispiel #9
0
        private void txtCompanyCode_Leave(object sender, EventArgs e)
        {
            var companyCode = txtCompanyCode.Text.Trim();
            var company     = CompanyFactory.FindByCode(companyCode);

            txtCompanyName.Text = company != null?Converter.TCVN3ToUnicode(company.CompanyName) : "";
        }
Beispiel #10
0
        public async Task CreateCompanyAsync(CompanyCreateRequest request)
        {
            Entities.Company company = CompanyFactory.CreateCompany(request);

            _companyRepository.Insert(company);

            await _unitOfWork.SaveAsync();
        }
Beispiel #11
0
        public void CreateNewCompany_WhenCreateCompanyWithValidDataIsPassed()
        {
            var company = new CompanyFactory();

            var newCompany = company.CreateCompany("Izgrev", "1234567890");

            Assert.IsInstanceOf(typeof(Company), newCompany);
        }
Beispiel #12
0
        public void init()
        {
            //set permission for user
            btnAdd.Visible = btnUpdate.Visible = btnDelete.Visible = _userInfo.UserPermission.Contains(ConstantInfo.PERMISSON_QUAN_LY_THONG_TIN_DOANH_NGHIEP);

            List <tblCompany> list = CompanyFactory.getTopCompany();

            grvCompany.AutoGenerateColumns = false;
            grvCompany.DataSource          = list;
        }
        public List <SelectListItem> GetDataStore(List <string> listOrganizationId)
        {
            StoreFactory   _storeFactory   = new StoreFactory();
            CompanyFactory _companyFactory = new CompanyFactory();

            ListStore = new List <SelectListItem>();
            ListStore = _storeFactory.GetListStore(listOrganizationId);
            //ListStore = _storeFactory.GetListStore(_companyFactory.GetListCompany(listOrganizationId));
            return(ListStore);
        }
Beispiel #14
0
        public async Task <IActionResult> Create([FromBody] NewUpdateCompany newCompany)
        {
            newCompany.StoreId = GetStoreId();

            var company = CompanyFactory.CreateCompany(newCompany);

            await _writeRepository.CreateAsync(company);

            return(Ok(company));
        }
Beispiel #15
0
        private void txtBc_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar.ToString().Equals("\r"))
            {
                try
                {
                    if (txtBc.Text == "")
                    {
                        txtBc.Focus(); return;
                    }

                    string shift = txtBc.Text.Trim().ToUpper();
                    switch (shift)
                    {
                    case "$QUIT":
                        Process.Start("shutdown.exe", "-s -t 10");
                        break;

                    case "$EXIT":
                        this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                        this.Close();
                        break;

                    case "$CANC":
                        txtBc.Focus();
                        break;

                    default:
                        break;
                    }

                    DB.WriteConfigLocal("SHIFT_CODE", shift);
                    LoginInfo.ShiftInfo = ShiftFactory.GetBySCode(shift);
                    List <ProductLineEntity> plines = ProductLineFactory.GetAll();
                    DB.WriteConfigLocal("COMPANY_CODE", LoginInfo.ShiftInfo.COMPANY_CODE);
                    LoginInfo.CompanyInfo = CompanyFactory.GetByKey(LoginInfo.ShiftInfo.COMPANY_CODE);
                    txtBc.Text            = "";
                    txtBc.Text            = LoginInfo.ShiftInfo.SHIFT_NAME;
                    e.Handled             = true;
                    //if (txtBz.Text == "")
                    {
                        txtBz.Focus(); return;
                    }
                }
                catch
                {
                    txtBc.Text            = "";
                    txtBc.SelectionStart  = 0;
                    txtBc.SelectionLength = txtBc.Text.Length;
                    txtBc.Focus();
                }
                //this.button1_Click(txtBz, null);
            }
        }
Beispiel #16
0
        public ResultModels InsertCompany(List <CompanyModels> lstInfo)
        {
            var result = new ResultModels();

            if (lstInfo != null && lstInfo.Any())
            {
                CompanyFactory CompanyFactory = new CompanyFactory();
                // result.IsOk = CompanyFactory.Insert(lstInfo);
            }
            return(result);
        }
        private void txtCompanyCode_Leave(object sender, EventArgs e)
        {
            var company = CompanyFactory.FindByCode(txtCompanyCode.Text.Trim());

            txtCompanyName.Text = company != null?Converter.TCVN3ToUnicode(company.CompanyName) : "";

            if (company == null)
            {
                txtCompanyCode.Text = string.Empty;
            }
        }
Beispiel #18
0
        public static BaseCompany QueryByBoxID(string boxId)
        {
            if (string.IsNullOrWhiteSpace(boxId))
            {
                throw new ArgumentNullException("boxId");
            }

            ICompany factory = CompanyFactory.GetFactory();

            return(factory.QueryByBoxID(boxId));
        }
Beispiel #19
0
        /// <summary>
        /// 查询顶级单位
        /// </summary>
        /// <param name="recordId"></param>
        /// <returns></returns>
        public static BaseCompany QueryTopCompanyByRecordId(string recordId)
        {
            if (string.IsNullOrWhiteSpace(recordId))
            {
                throw new ArgumentNullException("recordId");
            }

            ICompany factory = CompanyFactory.GetFactory();

            return(factory.QueryTopCompanyByRecordId(recordId));
        }
Beispiel #20
0
        public static BaseCompany QueryByParkingId(string parkingId)
        {
            if (string.IsNullOrWhiteSpace(parkingId))
            {
                throw new ArgumentNullException("parkingId");
            }

            ICompany factory = CompanyFactory.GetFactory();

            return(factory.QueryByParkingId(parkingId));
        }
Beispiel #21
0
        public static List <BaseCompany> QueryCompanysByMasterID(string masterId)
        {
            if (string.IsNullOrWhiteSpace(masterId))
            {
                throw new ArgumentNullException("masterId");
            }

            ICompany factory = CompanyFactory.GetFactory();

            return(factory.QueryCompanysByMasterID(masterId));
        }
Beispiel #22
0
        /// <summary>
        /// 查询单位包含所有下级单位
        /// </summary>
        /// <param name="recordId"></param>
        /// <returns></returns>
        public static List <BaseCompany> QueryCompanyAndSubordinateCompany(string recordId)
        {
            if (string.IsNullOrWhiteSpace(recordId))
            {
                throw new ArgumentNullException("recordId");
            }

            ICompany factory = CompanyFactory.GetFactory();

            return(factory.QueryCompanyAndSubordinateCompany(recordId));
        }
Beispiel #23
0
        public static List <BaseCompany> QueryCompanyByRecordIds(List <string> recordIds)
        {
            if (recordIds == null || recordIds.Count == 0)
            {
                throw new ArgumentNullException("recordIds");
            }

            ICompany factory = CompanyFactory.GetFactory();

            return(factory.QueryCompanyByRecordIds(recordIds));
        }
Beispiel #24
0
        public CompanyApplicationServiceTests()
        {
            repository                = new FakeCompanyRepository();
            locationService           = new LocationService(new FakeCityRepository(), new StateFakeRepository(), new CountryFakeRepository());
            bus                       = new FakeServiceBus();
            uow                       = new FakeUnitOfWork();
            identityResolver          = new FakeIdentityResolver();
            domainNotificationHandler = new DomainNotificationHandler();
            factory                   = new CompanyFactory();

            service = new CompanyApplicationService(repository, factory, locationService, identityResolver, domainNotificationHandler, uow, bus);
        }
 public IngStoreSettingsController()
 {
     _storeFactory   = new StoreFactory();
     _factory        = new StoreSettingFactory();
     _factoryCompany = new CompanyFactory();
     //================
     if (CurrentUser != null)
     {
         listOrganization = CurrentUser.ListOrganizationId;
     }
     lstCompany    = _factoryCompany.GetListCompany(listOrganization);
     listCompanyId = lstCompany.Select(x => x.Value).ToList();
     lstStore      = _storeFactory.GetListStore(listOrganization);
 }
Beispiel #26
0
        public void set_company_cases() //Factory Done
        {
            Case   case_comp = new CompanyFactory().GetCase();
            string line;

            // Read the file and display it line by line.
            System.IO.StreamReader file = new System.IO.StreamReader(dir + "/Monopoly_SELMI_TRAN_DINH/Monopoly_SELMI_TRAN_DINH/bin/Debug/Company.txt");
            while ((line = file.ReadLine()) != null)
            {
                string[] words = line.Split(',');
                board[int.Parse(words[0])] = case_comp.GetCase();
            }
            file.Close();
        }
Beispiel #27
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.grvCompany.SelectedRows.Count > 0)
                {
                    DialogResult result = MessageBox.Show("Bạn thự sự muốn xóa doanh nghiệp đã chọn?", "Cảnh báo!", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        int selectedIndex = grvCompany.SelectedRows[0].Index;

                        // gets the RowID from the first column in the grid
                        var companyCode = grvCompany[0, selectedIndex].Value.ToString();

                        tblCompany company = CompanyFactory.FindByCode(companyCode);
                        if (company == null)
                        {
                            MessageBox.Show("Loại hình này không còn tồn tại trong Cơ Sở Dữ Liệu. Bạn hãy kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        if (CompanyFactory.Delete(companyCode) > 0)
                        {
                            search();
                            MessageBox.Show("Xóa doanh nghiệp thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            search();
                            MessageBox.Show("Xóa doanh nghiệp không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("Bạn cần chọn một bản ghi để xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                if (GlobalInfo.IsDebug)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Beispiel #28
0
        public async Task <IActionResult> Update(string id, [FromBody] NewUpdateCompany updateCompany)
        {
            var company = await _readRepository.GetAsync(id);

            company = CompanyFactory.UpdateCompany(company, updateCompany);

            var result = await _writeRepository.UpdateAsync(company);

            if (!result.IsAcknowledged)
            {
                return(BadRequest());
            }

            return(Ok());
        }
Beispiel #29
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (initing)
            {
                return;
            }
            object val = comboBox1.SelectedValue;

            if (val != null)
            {
                DB.WriteConfigLocal("COMPANY_CODE", val.ToString());
                LoginInfo.CompanyInfo = CompanyFactory.GetByKey(val.ToString());
                initComboBoxByCompany();
            }
        }
        private void SaveMedicineIfNew()
        {
            PharmacyDbContext db       = new PharmacyDbContext();
            Medicine          medicine = new Medicine();

            medicine = db.Medicine.FirstOrDefault(a => a.Name == txtMedicine.Text);
            if (medicine != null)
            {
                medicine.Name        = txtMedicine.Text;
                medicine.Id          = UniqueNumber.GenerateUniqueNumber();
                medicine.CreatedBy   = currentUser;
                medicine.CreatedDate = DateTime.Now;
                medicine.GroupId     = GroupFactory.GetGroupId(txtGroup.Text, currentUser);
                medicine.CompanyId   = CompanyFactory.GetCompanyId(txtCompany.Text, currentUser);
                db.Medicine.Add(medicine);
            }
        }