Пример #1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Create"))
                {
                    return;
                }
                if (dgvLists.Rows.Count == 0)
                {
                    refresh("ViewAll", "", "", false);
                }
                switch (lType.Name)
                {
                case "Client":
                    ClientDetailUI loClientDetail = new ClientDetailUI();
                    loClientDetail.ParentList = this;
                    loClientDetail.ShowDialog();
                    break;

                case "Area":
                    AreaDetailUI loAreaDetail = new AreaDetailUI();
                    loAreaDetail.ParentList = this;
                    loAreaDetail.ShowDialog();
                    break;

                case "Branch":
                    BranchDetailUI loBranchDetail = new BranchDetailUI();
                    loBranchDetail.ParentList = this;
                    loBranchDetail.ShowDialog();
                    break;

                case "Zone":
                    ZoneDetailUI loZoneDetail = new ZoneDetailUI();
                    loZoneDetail.ParentList = this;
                    loZoneDetail.ShowDialog();
                    break;

                case "Collector":
                    CollectorDetailUI loCollectorDetail = new CollectorDetailUI();
                    loCollectorDetail.ParentList = this;
                    loCollectorDetail.ShowDialog();
                    break;

                case "Product":
                    ProductDetailUI loProductDetail = new ProductDetailUI();
                    loProductDetail.ParentList = this;
                    loProductDetail.ShowDialog();
                    break;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnCreate_Click");
                em.ShowDialog();
                return;
            }
        }
Пример #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Update"))
                {
                    return;
                }

                for (int i = 0; i < lCountCol; i++)
                {
                    lRecord[i] = dgvLists.CurrentRow.Cells[i].Value.ToString();
                }

                if (lRecord.Length > 0)
                {
                    if (lRecord[0].ToString() != "")
                    {
                        switch (lType.Name)
                        {
                        case "Client":
                            ClientDetailUI loClientDetail = new ClientDetailUI(lRecord);
                            loClientDetail.ParentList = this;
                            loClientDetail.ShowDialog();
                            break;

                        case "Area":
                            AreaDetailUI loAreaDetail = new AreaDetailUI(lRecord);
                            loAreaDetail.ParentList = this;
                            loAreaDetail.ShowDialog();
                            break;

                        case "Branch":
                            BranchDetailUI loBranchDetail = new BranchDetailUI(lRecord);
                            loBranchDetail.ParentList = this;
                            loBranchDetail.ShowDialog();
                            break;

                        case "Zone":
                            ZoneDetailUI loZoneDetail = new ZoneDetailUI(lRecord);
                            loZoneDetail.ParentList = this;
                            loZoneDetail.ShowDialog();
                            break;

                        case "Collector":
                            CollectorDetailUI loCollectorDetail = new CollectorDetailUI(lRecord);
                            loCollectorDetail.ParentList = this;
                            loCollectorDetail.ShowDialog();
                            break;

                        case "Product":
                            ProductDetailUI loProductDetail = new ProductDetailUI(lRecord);
                            loProductDetail.ParentList = this;
                            loProductDetail.ShowDialog();
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnUpdate_Click");
                em.ShowDialog();
                return;
            }
        }