示例#1
0
 private void listAction1_PdfButtonClick(object sender, EventArgs e)
 {
     if (this.KontoView == null)
     {
         return;
     }
     KontoUtils.ExportGridToPDF(this.KontoView, splashScreenManager1);
 }
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == (Keys.F1 | Keys.Control))
     {
         KontoUtils.SaveLayoutGrid(this.GridLayoutFileName, this.gridView1);
         return(true);
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }
示例#3
0
 private void listAction1_CancelSettingsButtonClick(object sender, EventArgs e)
 {
     if (this.KontoView == null)
     {
         return;
     }
     GridSetting = false;
     KontoUtils.HideGridProperty(this.panelControl3, this.listAction1);
 }
示例#4
0
 private void listAction1_ResetSettingsButtonClick(object sender, EventArgs e)
 {
     if (this.KontoView == null)
     {
         return;
     }
     GridSetting = false;
     KontoUtils.ResetGridLayout("", this.KontoView);
 }
示例#5
0
        private void listAction1_ColumnSettingsButtonClick(object sender, EventArgs e)
        {
            if (this.KontoView == null)
            {
                return;
            }

            GridSetting = false;
            KontoUtils.LoadGridProperty(panelControl3, KontoView.FocusedColumn, listAction1);
        }
示例#6
0
        private void lkpAction1_GridSettingsButtonClick(object sender, EventArgs e)
        {
            if (this.KontoView == null)
            {
                return;
            }

            GridSetting = true;
            KontoUtils.LoadGridProperty(panelControl2, KontoView);
        }
示例#7
0
 private void listAction1_SaveSettingsButtonClick(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(this.GridLayoutFileName) || this.KontoView == null)
         {
             return;
         }
         KontoUtils.SaveLayoutGrid(this.GridLayoutFileName, this.KontoView);
     }
     catch (Exception ex)
     {
         MessageBoxAdv.Show("Error While Saveing", "Error", ex.ToString());
         Log.Information(ex, "save layout");
     }
 }
示例#8
0
        private void ListDateRange1_GetButtonClick(object sender, EventArgs e)
        {
            using (var _context = new KontoContext())
            {
                _context.Database.CommandTimeout = 0;

                _bmodelList = (from pd in _context.Barcodes
                               join p in _context.Products on pd.ProductId equals p.Id
                               join act in _context.Accs on pd.AccId equals act.Id
                               where pd.RefBarcodeId != 0

                               select new BarcodeTransDto
                {
                    ReportId = pd.ReportId,
                    BarcodeNo = pd.BarcodeNo,
                    ProductName = p.ProductName,
                    AccName = act.AccName,
                    Qty = pd.Qty
                }
                               ).ToList();
            }

            customGridControl1.DataSource = _bmodelList;
            if (string.IsNullOrEmpty(this.GridLayoutFileName) || this.KontoView == null)
            {
                return;
            }

            KontoUtils.RestoreLayoutGrid(this.GridLayoutFileName, this.KontoView);

            this.ActiveControl = customGridControl1;
            if (_bmodelList.Count == 0)
            {
                listAction1.EditDeleteDisabled(false);
            }
            else
            {
                listAction1.EditDeleteDisabled(true);
            }
        }
        private void PendingOrderView_Load(object sender, EventArgs e)
        {
            try
            {
                using (var db = new KontoContext())
                {
                    //var spcol = db.SpCollections.FirstOrDefault(k => k.Id ==
                    //  (int)SpCollectionEnum.PendingOrderonChallan);
                    List <PendingOrderDto> listDtos = new List <PendingOrderDto>();
                    //if (spcol == null)
                    //{
                    listDtos = db.Database.SqlQuery <PendingOrderDto>(
                        "dbo.PendingOrderonBom @CompanyId={0},@AccountId={1},@VoucherTypeID={2}",
                        KontoGlobals.CompanyId, this.AccId, VoucherTypeEnum.SalesOrder).ToList();
                    //}
                    //else
                    //{
                    //    listDtos = db.Database.SqlQuery<PendingOrderDto>(
                    //     spcol.Name + " @CompanyId={0},@AccountId={1},@VoucherTypeID={2}",
                    //     KontoGlobals.CompanyId, this.AccId, this.VoucherType).ToList();
                    //}
                    if (listDtos.Count == 0)
                    {
                        this.Close();
                        this.Dispose();
                        return;
                    }
                    this.gridControl1.DataSource = listDtos;
                    KontoUtils.RestoreLayoutGrid(this.GridLayoutFileName, gridView1);
                }
                this.ActiveControl = gridControl1;
            }

            catch (Exception ex)
            {
                Log.Error(ex, "Bom Pending Order View");
                MessageBox.Show(ex.ToString());
            }
        }
示例#10
0
        private void KontoMetroForm_Load(object sender, EventArgs e)
        {
            if (KontoLayout != null)
            {
                KontoUtils.RestoreMainFormLayout(this.MainLayoutFile, KontoLayout);
            }
            if (KontoMainView != null)
            {
                KontoUtils.RestoreLayoutGrid(this.GridLayoutFile, KontoMainView);
            }
            this.ResetPage();
            this.NewRec();

            navAction1.ModuleId = Convert.ToInt32(this.Tag);
            if (RBAC.UserRight == null || RBAC.UserRight.IsSysAdmin)
            {
                return;
            }

            this.Create_Permission   = RBAC.UserRight.HasPermission(Convert.ToInt32(this.Tag), (int)Permission.Create);
            this.Modify_Permission   = RBAC.UserRight.HasPermission(Convert.ToInt32(this.Tag), (int)Permission.Modify);
            this.Delete_Permission   = RBAC.UserRight.HasPermission(Convert.ToInt32(this.Tag), (int)Permission.Delete);
            this.View_Permission     = RBAC.UserRight.HasPermission(Convert.ToInt32(this.Tag), (int)Permission.View);
            this.Print_Permission    = RBAC.UserRight.HasPermission(Convert.ToInt32(this.Tag), (int)Permission.Print);
            this.Export_Permission   = RBAC.UserRight.HasPermission(Convert.ToInt32(this.Tag), (int)Permission.Export);
            this.Settings_Permission = RBAC.UserRight.HasPermission(Convert.ToInt32(this.Tag), (int)Permission.Settings);

            if (this.Create_Permission)
            {
                okSimpleButton.Enabled = true;
            }
            else
            {
                okSimpleButton.Enabled = false;
            }

            navAction1.SetPermission(this.Create_Permission, this.View_Permission, this.Print_Permission);
        }
示例#11
0
        private void ListDateRange1_GetButtonClick(object sender, EventArgs e)
        {
            try
            {
                using (var _db = new KontoContext())
                {
                    _db.Database.CommandTimeout = 0;

                    customGridView1.ShowLoadingPanel();

                    barcode_translist = (from bo in _db.BarcodeTrans
                                         join it in _db.Products on bo.ProductId equals it.Id
                                         join b in _db.Barcodes on bo.BarcodeId equals b.Id
                                         join e1 in _db.Emps on bo.EmpId equals e1.Id
                                         join dv in _db.Divisions on bo.DivId equals dv.Id
                                         where bo.TransType == 0 &&
                                         bo.VoucherDate >= listDateRange1.FromDate && bo.VoucherDate <= listDateRange1.ToDate
                                         select new BarcodeTransDto
                    {
                        VoucherDate = bo.VoucherDate,
                        BarcodeNo = bo.BarcodeNo,
                        ProductName = it.ProductName,
                        Remarks = bo.Remarks,
                        Qty = bo.Qty,
                        EmpName = e1.EmpName,
                        TrnasType = bo.TransType,
                        DivName = dv.DivisionName, Id = bo.Id
                    }
                                         ).ToList();

                    customGridView1.Columns.Clear();
                    customGridControl1.DataSource = barcode_translist;
                    customGridView1.HideLoadingPanel();


                    if (string.IsNullOrEmpty(this.GridLayoutFileName) || this.KontoView == null)
                    {
                        return;
                    }

                    if (barcode_translist.Count == 0)
                    {
                        listAction1.EditDeleteDisabled(false);
                    }
                    else
                    {
                        if (customGridView1.Columns.ColumnByFieldName("Id") != null && customGridView1.Columns.ColumnByFieldName("VoucherId") != null)
                        {
                            listAction1.EditDeleteDisabled(true);
                        }
                        else
                        {
                            listAction1.EditDeleteDisabled(false);
                        }
                    }

                    if (string.IsNullOrEmpty(this.GridLayoutFileName) || this.KontoView == null)
                    {
                        return;
                    }

                    KontoUtils.RestoreLayoutGrid(this.GridLayoutFileName, this.KontoView);
                    this.ActiveControl = customGridControl1;
                }
            }
            catch (Exception ex)
            {
                string str = ex.ToString();
            }
        }
示例#12
0
        private void ListDateRange1_GetButtonClick(object sender, EventArgs e)
        {
            this.GridLayoutFileName = listDateRange1.SelectedItem.LayoutFile;
            var DtCriterias = new DataTable();

            try
            {
                var db = new KontoContext();
                using (var con = new SqlConnection(db.Database.Connection.ConnectionString))
                {
                    using (var cmd = new SqlCommand(listDateRange1.SelectedItem.SpName, con))
                    {
                        cmd.CommandTimeout = 0;
                        cmd.Parameters.Add("@fromDate", SqlDbType.Int).Value  = listDateRange1.FromDate;
                        cmd.Parameters.Add("@ToDate", SqlDbType.Int).Value    = listDateRange1.ToDate;
                        cmd.Parameters.Add("@CompanyId", SqlDbType.Int).Value = KontoGlobals.CompanyId;
                        cmd.Parameters.Add("@BranchId", SqlDbType.Int).Value  = KontoGlobals.BranchId;
                        cmd.Parameters.Add("@YearId", SqlDbType.Int).Value    = KontoGlobals.YearId;
                        cmd.Parameters.Add("@VTypeId", SqlDbType.Int).Value   = (int)VoucherTypeEnum.StoreIssue;
                        if (listDateRange1.SelectedItem.Extra1 == "Deleted")
                        {
                            cmd.Parameters.Add("@Deleted", SqlDbType.Int).Value = 1;
                        }
                        if (listDateRange1.SelectedItem.GroupCol != null)
                        {
                            string grpCol = listDateRange1.SelectedItem.GroupCol;
                            cmd.Parameters.Add("@GrpBy", SqlDbType.Text).Value = listDateRange1.SelectedItem.GroupCol;
                        }
                        cmd.CommandType = CommandType.StoredProcedure;

                        con.Open();

                        DtCriterias.Load(cmd.ExecuteReader());
                        con.Close();
                        customGridView1.ShowLoadingPanel();
                        customGridView1.Columns.Clear();
                        customGridControl1.DataSource = DtCriterias;
                        customGridView1.HideLoadingPanel();
                    }
                }

                if (DtCriterias.Rows.Count == 0)
                {
                    listAction1.EditDeleteDisabled(false);
                }
                else
                {
                    if (customGridView1.Columns.ColumnByFieldName("Id") != null && customGridView1.Columns.ColumnByFieldName("VoucherId") != null)
                    {
                        listAction1.EditDeleteDisabled(true);
                    }
                    else
                    {
                        listAction1.EditDeleteDisabled(false);
                    }
                }

                if (string.IsNullOrEmpty(this.GridLayoutFileName) || this.KontoView == null)
                {
                    return;
                }

                KontoUtils.RestoreLayoutGrid(this.GridLayoutFileName, this.KontoView);
                this.ActiveControl = customGridControl1;
            }
            catch (Exception ex)
            {
                Log.Error(ex, "SJ List Error");
                MessageBoxAdv.Show(this, "Error While Generating List !!", "Exception ", ex.ToString());
            }
        }
示例#13
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == (Keys.P | Keys.Control))
            {
                var printBarButtonItem = navAction1.Controls["printSimpleButton"] as SimpleButton;
                printBarButtonItem.PerformClick();
                return(true);
            }
            else if (keyData == Keys.F10)
            {
                okSimpleButton.PerformClick();
            }

            else if (keyData == Keys.F5)
            {
                var filterBarButtonItem = navAction1.Controls["filterSimpleButton"] as SimpleButton;
                filterBarButtonItem.PerformClick();
                return(true);
            }
            else if (keyData == Keys.F12)
            {
                var listBarButtonItem = navAction1.Controls["listSimpleButton"] as SimpleButton;
                listBarButtonItem.PerformClick();
                return(true);
            }
            else if (keyData == Keys.Insert)
            {
                var newbBarButtonItem = navAction1.Controls["newSimpleButton"] as SimpleButton;
                newbBarButtonItem.PerformClick();
                return(true);
            }
            else if (keyData == (Keys.Home | Keys.Control))
            {
                var firstBarButtonItem = navAction1.Controls["firstSimpleButton"] as SimpleButton;
                firstBarButtonItem.PerformClick();
                return(true);
            }
            else if (keyData == (Keys.End | Keys.Control))
            {
                var lastBarButtonItem = navAction1.Controls["lastSimpleButton"] as SimpleButton;
                lastBarButtonItem.PerformClick();
                return(true);
            }
            else if (keyData == (Keys.Add | Keys.Control))
            {
                var nextBarButtonItem = navAction1.Controls["nextSimpleButton"] as SimpleButton;
                nextBarButtonItem.PerformClick();
                return(true);
            }
            else if (keyData == (Keys.Subtract | Keys.Control))
            {
                var prevBarButtonItem = navAction1.Controls["prevSimpleButton"] as SimpleButton;
                prevBarButtonItem.PerformClick();
                return(true);
            }
            else if (keyData == (Keys.F1 | Keys.Shift))
            {
                if (this.KontoLayout != null && !string.IsNullOrEmpty(this.MainLayoutFile))
                {
                    KontoUtils.SaveMainFormLayout(this.MainLayoutFile, KontoLayout);
                }

                if (this.KontoMainView != null && !string.IsNullOrEmpty(this.GridLayoutFile))
                {
                    KontoUtils.SaveLayoutGrid(this.GridLayoutFile, KontoMainView);
                }

                return(true);
            }
            else if (keyData == (Keys.F2 | Keys.Shift))
            {
                if (KontoMainView == null)
                {
                    return(false);
                }
                if (!KontoMainView.IsFocusedView)
                {
                    return(false);
                }
                var frm = new GridPropertView();
                frm.gridControl1.DataSource = this.KontoMainView.GridControl.DataSource;
                frm.gridView1.Assign(this.KontoMainView, false);
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return(true);
                }
                this.KontoMainView.Assign(frm.gridView1, false);
                KontoUtils.SaveLayoutGrid(this.GridLayoutFile, KontoMainView);
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
示例#14
0
        private void LoadData(BomModel model, KontoContext _context = null)
        {
            this.ResetPage();
            this.PrimaryKey         = model.Id;
            divLookUpEdit.EditValue = model.DivisionId;

            voucherLookup1.SelectedValue = model.VoucherId;

            Remark.Text = model.Remark;
            targetQtyButtonEdit.Text               = Convert.ToString(model.TargetQty);
            ordertypeLookUpEdit1.EditValue         = model.Description;
            voucherDateEdit.EditValue              = KontoUtils.IToD(model.VoucherDate);
            voucherNoTextEdit.Text                 = model.VoucherNo;
            QualityLookup.Properties.SelectedValue = model.ProductId;
            //QualityLookup.Properties.DisplayText =

            using (var _db = new KontoContext())
            {
                var prd = _db.Products.Find(model.ProductId);
                if (prd != null)
                {
                    QualityLookup.EditValue = prd.ProductName;
                    QualityLookup.Properties.DisplayText = prd.ProductName;
                }

                PFormula = (from b in _db.Boms
                            join bt in _db.BOMTranses on b.Id equals bt.BOMId
                            join q in _db.Products on bt.ProductId equals q.Id
                            join cate in _db.CategroyModels on bt.UomId equals cate.Id into j1
                            from s1 in j1.DefaultIfEmpty()
                            join col in _db.ColorModels on bt.ColorId equals col.Id into j2
                            from s2 in j2.DefaultIfEmpty()
                            where b.Id == model.Id && bt.TransType == 1
                            orderby b.ProductId
                            select new BomTransDto
                {
                    Amount = bt.Amount,
                    BaseQty = bt.BaseQty,
                    BOMId = bt.BOMId, Id = bt.Id, OrderTransId = bt.OrderTransId,
                    RefQty = bt.RefQty, RequireQty = bt.RequireQty, ShortQty = bt.ShortQty,
                    Stock = bt.Stock, UomId = bt.UomId,
                    ProductId = bt.ProductId,

                    ProductName = q.ProductName,
                    ColorId = bt.ColorId,
                    ColorName = s2.ColorName,

                    Rate = bt.Rate
                }).ToList();

                gridControl1.DataSource = PFormula;


                bomOrderDtos = (from b in _db.Boms
                                join bt in _db.BOMTranses on b.Id equals bt.BOMId
                                join q in _db.Products on bt.ProductId equals q.Id

                                join emp in _db.Emps on bt.UomId equals emp.Id into e1
                                from e2 in e1.DefaultIfEmpty()

                                join ot in _db.OrdTranses on bt.OrderTransId equals ot.Id into o1
                                from o2 in o1.DefaultIfEmpty()
                                join o in _db.Ords on o2.OrdId equals o.Id
                                join a in _db.Accs on o.AccId equals a.Id into a1
                                from a2 in a1.DefaultIfEmpty()

                                where b.Id == model.Id
                                orderby b.ProductId
                                select new BomOrderDto
                {
                    Id = bt.Id,
                    ProductId = bt.ProductId,
                    ProductName = q.ProductName,
                    OrderDate = o.VoucherDate,
                    OrderNo = o.RefNo,
                    EmpId = bt.UomId,
                    EmployeeName = e2.EmpName,
                    Qty = bt.BaseQty,
                    AccId = bt.AccId,
                    AccName = a2.AccName,
                    RefNo = o.RefNo,
                    Balance = bt.RequireQty,
                    StockQty = bt.Stock,
                    Remark1 = bt.Remark1,
                    Remark2 = bt.Remark2,
                    BomId = b.Id, OrderTransId = bt.OrderTransId
                }).ToList();

                gridControl2.DataSource = bomOrderDtos;
            }
        }