Ejemplo n.º 1
0
        private void FrmMaterial_Load(object sender, EventArgs e)
        {
            try
            {
                MaterialBLL oMaterial = new MaterialBLL();
                DataSet     ds        = oMaterial.listado();
                dt = ds.Tables[0];
                dgvMaterial.DataSource = dt;
                // dgvClientes.Enabled = false;
                if (dt.Rows.Count > 0)
                {
                    lblDatosNoEncontrados.Visible = false;
                    dgvMaterial_CellClick(null, null);
                }
                else
                {
                    lblDatosNoEncontrados.Visible = true;
                }

                MostrarGuardarCancelar(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("¿Realmente desea eliminar los materiales seleccionados?", "Eliminacion de material",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    foreach (DataGridViewRow row in dgvMaterial.Rows)
                    {
                        if (Convert.ToBoolean(row.Cells["Eliminar"].Value))
                        {
                            Material material = new Material();
                            material.Id = Convert.ToInt32(row.Cells["Id"].Value);

                            MaterialBLL miMaterialBLL      = new MaterialBLL();
                            int         registrosAfectados = miMaterialBLL.eliminar(material);

                            if (registrosAfectados != 1)
                            {
                                MessageBox.Show("El material no pudo ser eliminado", "Eliminacion de material",
                                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }

                    FrmMaterial_Load(null, null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 3
0
        private void UploadMaterialMaster()
        {
            try
            {
                string resultMsg = string.Empty;

                using (MaterialBLL materialBll = new MaterialBLL())
                {
                    resultMsg = materialBll.UploadMaterialMaster(this.dtCSVdata, this.LOCATION_ID, this.USER_ID);
                }

                if (resultMsg == "OK")
                {
                    NotifierResult.Show("Upload CSV Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    XtraMessageBox.Show(this, resultMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
        public UpdateMaterialForm()
        {
            InitializeComponent();

            openFormG = openFormL = openFormSH = openFormMT = false;


            material = new Material();
            mbll     = new MaterialBLL();


            InitializeComponent();
            BindGenre(new Genre()
            {
                GenreId = 0, _Genre = "Other"
            });
            BindMaterialType(new MaterialType()
            {
                MaterialTypeId = 0, _MaterialType = "Other"
            });
            BindShelf(new Shelf()
            {
                ShelfId = 0, Location = "Other"
            });
            BindLanguage(new Language()
            {
                LanguageId = 0, _Language = "Other"
            });
        }
Ejemplo n.º 5
0
        internal void SetMaterial(string id, string descripcion, string unidad)
        {
            try
            {
                MaterialBLL _MaterialBLL = new MaterialBLL();

                _Material = _MaterialBLL.ObtenerMaterial(int.Parse(id));


                if (_Material != null)
                {
                    txtMaterialId.Text          = id;
                    txtMaterialDescripcion.Text = descripcion;
                    txtUMedidaMaterial.Text     = unidad;
                    this.txtCantidadMaterial.Focus();
                }
                else
                {
                    MessageBox.Show("El Material No existe !", "Anteción", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);


                MessageBox.Show(msg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 6
0
    public MaterialCard ScanMatIn_Complete(string serialno, string location, string userid, out string resultMsg)
    {
        resultMsg = string.Empty;
        MaterialCard mtl = null;

        //remark userid value := userid & serial #
        string serial = string.Empty;

        string[] user_v = userid.Split('|');

        if (user_v.Length.Equals(2))
        {
            userid = user_v[0];
            serial = user_v[1];
        }

        try
        {
            using (MaterialBLL materialBll = new MaterialBLL())
            {
                mtl = materialBll.ScanMatIn_Complete(serialno, location, userid, out resultMsg);
            }

            // UserOnline.ProcessUserOnline(serial, userid, "Scan Material In.");
        }
        catch (Exception ex)
        {
            mtl = null;
            throw ex;
        }

        return(mtl);
    }
        private void InitializaLOVData()
        {
            try
            {
                //For Warehouse
                using (MaterialBLL mtlBll = new MaterialBLL())
                {
                    List <Location> lstLoc = mtlBll.GetLocationList();
                    if (lstLoc != null)
                    {
                        this.grvQrySummary_rps_lueLocation.DataSource = lstLoc;

                        lstLoc.Insert(0, new Location {
                            SEQ_NO = string.Empty, NAME = "(All)"
                        });
                        this.lueLocation.Properties.DataSource = lstLoc;
                    }
                }

                //for party
                using (PartyBLL partyBll = new PartyBLL())
                {
                    List <Party> lstParty = partyBll.LovPratyList("V", string.Empty);
                    lstParty.Insert(0, new Party {
                        PARTY_ID = string.Empty, PARTY_NAME = "(All)"
                    });

                    this.lueCUSTOMER.Properties.DataSource = lstParty;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> UploadModelData(List <M_Material> lstMat)
        {
            var uId = await base.CurrentUserId();

            lstMat.ForEach(m =>
            {
                m.Created_By = uId;
            });

            try
            {
                using (var matBll = new MaterialBLL())
                {
                    var rowaffected = await matBll.BulkInsertMaterial(lstMat);

                    _cache.Remove("CACHE_MASTER_MATERIAL");
                    _cache.Remove("CACHE_MASTER_MATERIAL_BYRAWTYPE");
                }

                return(Json(new { success = true, data = lstMat, message = "Import Success." }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = true, data = lstMat, message = ex.Message }));
            }
        }
Ejemplo n.º 9
0
        // GET: Master/Material
        public async Task <IActionResult> GetMaterial()
        {
            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_MATERIAL", out List <M_Material> c_lstMat))
                {
                    return(Json(new { data = c_lstMat }));
                }

                MemoryCacheEntryOptions options = new MemoryCacheEntryOptions
                {
                    AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300),
                    SlidingExpiration = TimeSpan.FromSeconds(60),
                    Priority          = CacheItemPriority.NeverRemove
                };

                using (var matBll = new MaterialBLL())
                {
                    var lstMat = await matBll.GetMaterial(null);

                    _cache.Set("CACHE_MASTER_MATERIAL", lstMat, options);

                    return(Json(new { data = lstMat }));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> Edit([Bind("MaterialCode,MaterialName,MaterialDesc1,MaterialDesc2,RawMatTypeId,UnitId,PackageStdQty,WarehouseId,LocationId,CompanyCode,MaterialImagePath,Id,Is_Active,Created_Date,Created_By,Updated_Date,Updated_By")] M_Material m_Material)
        {
            if (ModelState.IsValid)
            {
                m_Material.Updated_By = await base.CurrentUserId();

                ResultObject resultObj;

                try
                {
                    using (var matBll = new MaterialBLL())
                    {
                        resultObj = await matBll.UpdateMaterial(m_Material);

                        _cache.Remove("CACHE_MASTER_MATERIAL");
                        _cache.Remove("CACHE_MASTER_MATERIAL_BYRAWTYPE");
                    }

                    return(Json(new { success = true, data = (M_Material)resultObj.ObjectValue, message = "Material Update." }));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, data = m_Material, message = ex.Message }));
                }
            }

            var err = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList();

            return(Json(new { success = false, errors = err, data = m_Material, message = "Update Failed" }));
        }
Ejemplo n.º 11
0
        private void FillMovimentacoes()
        {
            Material mat = (Material)listMateriais.SelectedItem;

            if (mat == null)
            {
                return;
            }

            MaterialBLL bll = new MaterialBLL();
            var         movimentosEstoque = bll.GetMovimentosEstoque(mat.Id, txDataInicio.SelectedDate ?? DateTime.Now,
                                                                     txDataFim.SelectedDate ?? DateTime.Now);

            if (rdoEntradas.IsChecked.Value)
            {
                movimentosEstoque = movimentosEstoque.Where(m => m.Tipo.Equals("Entrada")).ToList();
            }
            if (rdoSaidas.IsChecked.Value)
            {
                movimentosEstoque = movimentosEstoque.Where(m => m.Tipo.Equals("Saída")).ToList();
            }

            spMovimentos.Children.Clear();
            movimentosEstoque.ForEach(m => spMovimentos.Children.Add(new CardMovimentoEstoque(m)));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MatSaveBtn_Click(object sender, EventArgs e)
        {
            DateTime now  = DateTime.Now;
            string   user = UserBLL.userInfo.UserName;

            if (string.IsNullOrEmpty(materialTB.Text.Trim()))
            {
                MessageBox.Show("物料号不能为空!", "警告");
                materialTB.Focus();
                return;
            }
            #region 组装物料
            tblMaterial mat = new tblMaterial
            {
                MAT_ID      = materialTB.Text.Trim(),
                MAT_OLD     = oldMaterialTB.Text.Trim().ToUpper(),
                MAT_DESC    = matDesc.Text.Trim(),
                MAT_OLDDESC = oldMatDesc.Text.Trim(),
                MAT_SPECI   = matSpeci.Text.Trim(),
                MAT_JHSPECI = matJHSpeci.Text.Trim(),
                MAT_STATUS  = Mat_Status.启用.GetHashCode(),
                CREATEDATE  = now,
                CREATEUSER  = user,
                MODIFYDATE  = now,
                MODIFYUSER  = user
            };
            #endregion
            MaterialBLL matbll = new MaterialBLL();
            var         result = matbll.AddMatInfo(mat);
            MessageBox.Show(result.Msg);
            materialTB.Text = "";
        }
        private void Buscar()
        {
            List <Material> mats = new MaterialBLL().Search(txPesquisa.Text);

            listBox.DisplayMemberPath = "Descricao";
            listBox.ItemsSource       = mats;
        }
Ejemplo n.º 14
0
        public void GetMaterialList(string findAll)
        {
            List <Material> lstMaterial = null;

            try
            {
                base.ExecutionStart();
                base.BeginProcessing("Begin Load data...", "Please Waiting for Loading Data");

                using (MaterialBLL materialBll = new MaterialBLL())
                {
                    lstMaterial = materialBll.GetMaterialList(findAll);
                }

                this.grdMaterial.DataSource = lstMaterial;
                this.dntProduct.DataSource  = lstMaterial;

                base.ExecutionStop();
            }
            catch (Exception ex)
            {
                base.FinishedProcessing();
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                base.FinishedProcessing();
                ((frmMainMenu)this.ParentForm).ExecuteTime.Caption = base.ExecuteTime;
            }
        }
Ejemplo n.º 15
0
        public int Update(MaterialModel ObjModel)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    num = new MaterialBLL().Update(ObjModel, transaction);
                    transaction.Commit();
                    return(num);
                }
                catch (SqlException exception)
                {
                    transaction.Rollback();
                    connection.Close();
                    throw exception;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Ejemplo n.º 16
0
        public List <MaterialModel> GetMaterialList(MaterialQueryModel QueryModel)
        {
            List <MaterialModel> models     = new List <MaterialModel>();
            SqlConnection        connection = new SqlConnection(FunctionRule.GetConnectionString());

            try
            {
                if (QueryModel == null)
                {
                    QueryModel = new MaterialQueryModel();
                }
                models = new MaterialBLL().GetModels(QueryModel, connection);
                connection.Close();
            }
            catch (SqlException exception)
            {
                throw exception;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Dispose();
                }
            }
            return(models);
        }
Ejemplo n.º 17
0
        public void GetBindingMaterial(string mtlSeq)
        {
            Material material = null;

            try
            {
                base.BeginProcessing("Begin Load data...", "Please Waiting for Loading Data");

                using (MaterialBLL materialBll = new MaterialBLL())
                {
                    material = materialBll.GetMaterial(mtlSeq);
                }

                if (material != null)
                {
                    this.txtMTL_SEQ_NO.EditValue = material.MTL_SEQ_NO;
                    this.txtMTL_CODE.EditValue   = material.MTL_CODE;
                    this.txtMTL_NAME.EditValue   = material.MTL_NAME;
                    this.txtMTL_GRADE.EditValue  = material.MTL_GRADE;
                    this.txtMTL_COLOR.EditValue  = material.MTL_COLOR;

                    this.lueUNIT.EditValue = material.UNIT;

                    this.txtSTD_QTY.EditValue = material.STD_QTY;
                    this.txtMIN_QTY.EditValue = material.MIN_QTY;
                    this.txtMAX_QTY.EditValue = material.MAX_QTY;

                    this.btePARTY_ID.EditValue   = material.PARTY_ID;
                    this.txtPARTY_NAME.EditValue = material.PARTY_NAME;

                    if (material.MTL_IMAGE != null)
                    {
                        this.picMTL_IMAGE.Image = material.MTL_IMAGE;
                    }
                    else
                    {
                        this.picMTL_IMAGE.Image = this._emptyImage;
                    }
                    this.lueLOCATION_ID.EditValue = material.LOCATION_ID;

                    this.txtREMARK.Text        = material.REMARK;
                    this.icbREC_STAT.EditValue = material.REC_STAT;
                }
                else
                {
                    this.ClearDataOnScreen();
                    XtraMessageBox.Show(this, "No Data found.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                base.FinishedProcessing();
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                base.FinishedProcessing();
            }
        }
Ejemplo n.º 18
0
        private void FillDetalhes()
        {
            Material mat = (Material)listMateriais.SelectedItem;

            if (mat == null)
            {
                return;
            }

            MaterialBLL bll = new MaterialBLL();

            mat = bll.Find(mat.Id);
            var movimentosEstoque = bll.GetMovimentosEstoque(mat.Id, txDataInicio.SelectedDate ?? DateTime.Now,
                                                             txDataFim.SelectedDate ?? DateTime.Now);

            gridDetalhes.Visibility      = Visibility.Visible;
            lbNomeMaterial.Content       = mat.Descricao;
            lbTotalEntradas.Content      = movimentosEstoque.Count(m => m.Tipo.Equals("Entrada")).ToString();
            lbTotalQuantEntradas.Content = $"{ movimentosEstoque.Where(m => m.Tipo.Equals("Entrada")).Select(m => m.Quant).Sum().ToString()} UN";
            lbTotalSaidas.Content        = movimentosEstoque.Count(m => m.Tipo.Equals("Saída")).ToString();
            lbTotalQuantSaidas.Content   = $"{ movimentosEstoque.Where(m => m.Tipo.Equals("Saída")).Select(m => m.Quant).Sum().ToString()} UN";
            lbEstoqueAtual.Content       = mat.Estoque.ToString();

            int mediaVendaPeriodo = mat.MediaDiariaMaterial(txDataInicio.SelectedDate ?? DateTime.Now,
                                                            txDataFim.SelectedDate ?? DateTime.Now);

            lbMediaVendaDiaria.Content = $"{mediaVendaPeriodo} UN";

            int diasRestantesEstoque = 0;

            try
            {
                diasRestantesEstoque = (mat.Estoque / mediaVendaPeriodo);
            }
            catch { }

            if (mediaVendaPeriodo == 0)
            {
                bannerDiasRestantes.Visibility = Visibility.Hidden;
            }
            else
            {
                bannerDiasRestantes.Visibility = Visibility.Visible;
            }

            lbDiasRestantes.Content = $"Restam {diasRestantesEstoque} dias de estoque para este material";
            if (diasRestantesEstoque <= 3)
            {
                bannerDiasRestantes.Background  = (Brush) new BrushConverter().ConvertFrom("#FFFFE0E0");
                bannerDiasRestantes.BorderBrush = (Brush) new BrushConverter().ConvertFrom("#FFFF7373");
                lbDiasRestantes.Foreground      = (Brush) new BrushConverter().ConvertFrom("Red");
            }
            else
            {
                bannerDiasRestantes.Background  = (Brush) new BrushConverter().ConvertFrom("#FFCAE7FF");
                bannerDiasRestantes.BorderBrush = (Brush) new BrushConverter().ConvertFrom("#FF006C67");
                lbDiasRestantes.Foreground      = (Brush) new BrushConverter().ConvertFrom("Black");
            }
        }
Ejemplo n.º 19
0
        private void btnAgregarMaterial_Click(object sender, EventArgs e)
        {
            btnAgregarMaterial.Visible = false;
            try
            {
                _Producto.Id                    = Convert.ToInt32(txtId.Text);
                _Producto.Categoria.Id          = Convert.ToInt32(txtCategoriaId.Text);
                _Producto.Categoria.Descripcion = txtCategoriaDescripcion.Text;

                MaterialBLL _MaterialBLL = new MaterialBLL();

                _Material = _MaterialBLL.ObtenerMaterial(int.Parse(this.txtMaterialId.Text));
                misMateriales.Add(_Material);


                if (_Material == null)
                {
                    MessageBox.Show("El Material No existe !", "Anteción", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }


                DetalleMaterial oDetalleMaterial = new DetalleMaterial()
                {
                    Producto      = _Producto,
                    Material      = _Material,
                    UnidadMedidad = txtUMedidaMaterial.Text,
                    Cantidad      = int.Parse(txtCantidadMaterial.Text),
                    Costo         = 0
                                    //  No_Linea = this.dgvDatos.Rows.Count,
                };
                _Producto.AgregarMaterial(oDetalleMaterial);


                oDetalleMaterial = _Producto.AgregarMaterial(oDetalleMaterial);

                txtPrecioVenta.Text = "";
                txtPrecioVenta.Text = _Producto.CalcularPrecioProducto().ToString();

                string[] item = { oDetalleMaterial.Material.Id.ToString(),     oDetalleMaterial.Material.Descripcion, oDetalleMaterial.Material.Uni_Medida,
                                  oDetalleMaterial.Material.Precio.ToString(), oDetalleMaterial.Cantidad.ToString(),  oDetalleMaterial.Costo.ToString() };

                dgvListaMateriales.Rows.Add(item);

                this.txtMaterialId.Clear();
                this.txtMaterialDescripcion.Clear();
                this.txtUMedidaMaterial.Clear();
                this.txtCantidadMaterial.Clear();

                _Material = null;
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                MessageBox.Show(msg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 20
0
        public async Task <IActionResult> DeleteConfirmed(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ResultObject resultObj;

            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_MATERIAL", out List <M_Material> c_lstMat))
                {
                    var m_Material = c_lstMat.Find(m => m.Id == id);

                    if (m_Material == null)
                    {
                        return(NotFound());
                    }

                    m_Material.Updated_By = await base.CurrentUserId();

                    using (var matBll = new MaterialBLL())
                    {
                        resultObj = await matBll.DeleteMaterial(m_Material);

                        _cache.Remove("CACHE_MASTER_MATERIAL");
                    }

                    return(Json(new { success = true, data = (M_Material)resultObj.ObjectValue, message = "Material Deleted." }));
                }

                using (var matBll = new MaterialBLL())
                {
                    var lstMat = await matBll.GetMaterial(id);

                    var m_Material = lstMat.First();

                    if (m_Material == null)
                    {
                        return(NotFound());
                    }

                    m_Material.Updated_By = await base.CurrentUserId();

                    resultObj = await matBll.DeleteMaterial(m_Material);

                    _cache.Remove("CACHE_MASTER_MATERIAL");
                    _cache.Remove("CACHE_MASTER_MATERIAL_BYRAWTYPE");
                }

                return(Json(new { success = true, data = (M_Material)resultObj.ObjectValue, message = "Material Deleted." }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }
        }
        private void InitializaLOVData()
        {
            try
            {
                //for warehouse
                //using (QueryBLL queryBll = new QueryBLL())
                //{
                //    List<Warehouse> lstWH = queryBll.GetWarehouse();
                //    if (lstWH != null)
                //    {
                //        lstWH.Insert(0, new Warehouse { SEQ_NO = string.Empty, NAME = "(All)" });
                //        this.lueWarehouse.Properties.DataSource = lstWH;
                //        this.rps_lueWH.DataSource = lstWH;
                //    }
                //}
                using (MaterialBLL mtlBll = new MaterialBLL())
                {
                    List <Location> lstLoc = mtlBll.GetLocationList();
                    if (lstLoc != null)
                    {
                        // this.grvQrySummary_rps_lueLocation.DataSource = lstLoc;

                        lstLoc.Insert(0, new Location {
                            SEQ_NO = string.Empty, NAME = "(All)"
                        });
                        this.lueWarehouse.Properties.DataSource = lstLoc;
                        this.rps_lueWH.DataSource = lstLoc;
                    }
                }


                //for ARR TYPE
                using (ArrivalBLL arrBll = new ArrivalBLL())
                {
                    List <M_ARRIVAL_TYPE> lstARR_TYPE = arrBll.GetArrivalTypeList();
                    if (lstARR_TYPE != null)
                    {
                        //  lstWH.Insert(0, new Warehouse { SEQ_NO = string.Empty, NAME = "(All)" });
                        //    this.lueWarehouse.Properties.DataSource = lstWH;
                        this.rps_lueARR_TYPE.DataSource = lstARR_TYPE;
                    }
                }

                //for party
                using (PartyBLL partyBll = new PartyBLL())
                {
                    List <Party> lstParty = partyBll.LovPratyList("V", string.Empty);
                    lstParty.Insert(0, new Party {
                        PARTY_ID = string.Empty, PARTY_NAME = "(All)"
                    });
                    this.lueCUSTOMER.Properties.DataSource = lstParty;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 22
0
        private void FillMateriais()
        {
            MaterialBLL bll  = new MaterialBLL();
            var         list = bll.Search(txPesquisa.Text);

            listMateriais.DisplayMemberPath = "Descricao";
            list.ForEach(m => m.Descricao   = $"{m.Descricao}, {m.Estoque} Un");
            listMateriais.ItemsSource       = list;
        }
        private void BtnSearchUser_Click(object sender, EventArgs e)
        {
            mbll     = new MaterialBLL();
            material = new Material();

            int  n;
            bool isNumeric = int.TryParse(txtMaterialID.Text, out n);

            if (isNumeric)
            {
                material = mbll.Get(n);
            }

            if (material != null)
            {
                txtTitle.Text = material.Title;

                txtAuthor.Text = material._Author.AuthorName;
                if (material.ISBN != string.Empty || material.ISBN.Length != null)
                {
                    txtISBN.Text = material.ISBN;
                }

                txtPages.Text = material.NumberOfPages.ToString();

                if (true)
                {
                    txtPublishDate.Text = material.PublishYear.Year.ToString();
                }


                if (material._PublishHouse._PublishHouse != string.Empty || material._PublishHouse._PublishHouse != null)
                {
                    txtPublishHouse.Text = material._PublishHouse._PublishHouse;
                }


                txtQuantity.Text = material.Quantity.ToString();

                if (material.IsActive == true)
                {
                    comboActiveMaterial.SelectedIndex = 0;
                }
                else
                {
                    comboActiveMaterial.SelectedIndex = 1;
                }

                BindGenre(material._Genre);
                BindMaterialType(material._MaterialType);
                BindShelf(material._Shelf);
                BindLanguage(material._Language);
            }
        }
        private void DashboardForm_Activated(object sender, EventArgs e)
        {
            subscriberBLL = new SubscriberBLL();
            materialBLL   = new MaterialBLL();
            borrbll       = new BorrowBLL();

            comboMembers.SelectedIndex = 0;

            txtTotalMembers.Text    = subscriberBLL.GetTotalCountSubscribers().ToString();
            txtTotalMaterials.Text  = materialBLL.GetTotalCountMaterials().ToString();
            txtTotalBorrowings.Text = borrbll.GetTotalCountBorrowings().ToString();
        }
Ejemplo n.º 25
0
        private void InitializaLOVData()
        {
            List <Unit> lstUnit;

            using (MaterialBLL mtlBll = new MaterialBLL())
            {
                lstUnit = mtlBll.GetUnitList();
            }

            if (lstUnit != null)
            {
            }
        }
Ejemplo n.º 26
0
        private void button_Copy_Click(object sender, RoutedEventArgs e)
        {
            List <Material> list = new MaterialBLL().Search(txPesquisa.Text);

            list.ForEach(mat =>
            {
                if (MaterialEntrada.Count(m => m.Id == mat.Id) == 0)
                {
                    MaterialEntrada.Add(mat);
                }
            });

            listMateriaisEntradas.Items.Refresh();
        }
 public Prescricao_UserControl()
 {
     InitializeComponent();
     materialBLL         = new MaterialBLL();
     this.escalaBLL      = new EscalaBLL();
     this.medicamentoBLL = new MedicamentoBLL();
     this.diaSemanaBLL   = new DiaSemanaBLL();
     this.sal_MineralBLL = new Sal_MineralBLL();
     CarregarDadosPadrao();
     this.prescricaoBLL          = new PrescricaoBLL();
     prescricao                  = new Prescricao();
     list_Prescricao_Sal_Mineral = new List <Prescricao_Sal_Mineral>();
     listPrescricao_Material     = new List <Prescricao_Material>();
     listPrescricao_Medicamento  = new List <Prescricao_Medicamento>();
 }
Ejemplo n.º 28
0
        //public DeleteMaterialForm(Material material)
        //{
        //    InitializeComponent();

        //    materialbll = new MaterialBLL();

        //    txtMaterialID.Text = material.MaterialId.ToString();
        //    txtTitle.Text = material.Title;
        //    txtGenre.Text = material._Genre._Genre;
        //    txtLanguage.Text = material._Language._Language;
        //    txtAuthor.Text = material._Author.AuthorName;

        //        txtISBN.Text = material.ISBN;

        //    txtMaterialType.Text = material._MaterialType._MaterialType;

        //    txtPages.Text = material.NumberOfPages.ToString();


        //        txtPublishDate.Text = material.PublishYear.Year.ToString();


        //        txtPublishHouse.Text = material._PublishHouse._PublishHouse;



        //    txtQuantity.Text = material.Quantity.ToString();
        //}

        private void BtnSearchMaterial_Click(object sender, EventArgs e)
        {
            try
            {
                materialbll = new MaterialBLL();
                material    = new Material();

                int  n;
                bool isNumeric = int.TryParse(txtMaterialID.Text, out n);

                if (isNumeric)
                {
                    material = materialbll.Get(n);
                }

                if (material != null)
                {
                    txtTitle.Text    = material.Title;
                    txtGenre.Text    = material._Genre._Genre;
                    txtLanguage.Text = material._Language._Language;
                    txtAuthor.Text   = material._Author.AuthorName;
                    if (material.ISBN.Length > 1)
                    {
                        txtISBN.Text = material.ISBN;
                    }
                    txtMaterialType.Text = material._MaterialType._MaterialType;

                    txtPages.Text = material.NumberOfPages.ToString();

                    if (true)
                    {
                        txtPublishDate.Text = material.PublishYear.Year.ToString();
                    }


                    if (material._PublishHouse._PublishHouse.Length > 1)
                    {
                        txtPublishHouse.Text = material._PublishHouse._PublishHouse;
                    }


                    txtQuantity.Text = material.Quantity.ToString();
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 29
0
        private void InitializaLOVData()
        {
            this._emptyImage = base.Language.GetBitmap("EmptyImage");

            try
            {
                using (MaterialBLL mtlBll = new MaterialBLL())
                {
                    //for Unit
                    List <Unit> lstUnit = mtlBll.GetUnitList();
                    if (lstUnit != null)
                    {
                        this.lueUNIT.Properties.DataSource = lstUnit;

                        if (lstUnit.Count > 0)
                        {
                            Unit unitTemp = lstUnit.Find(delegate(Unit _unit)
                            {
                                return(_unit.SEQ_NO == "KG");
                            });
                            if (unitTemp != null)
                            {
                                this.lueUNIT.EditValue = unitTemp.SEQ_NO;
                            }
                            else
                            {
                                //default
                                this.lueUNIT.EditValue = lstUnit[0].SEQ_NO;
                            }
                        }
                    }

                    //for Location
                    List <Location> lstLoc = mtlBll.GetLocationList();
                    if (lstLoc != null)
                    {
                        this.lueLOCATION_ID.Properties.DataSource     = lstLoc;
                        this.lueLocationUpload.Properties.DataSource  = lstLoc;
                        this.grvProduct_rps_lueLOCATION_ID.DataSource = lstLoc;
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
 public Prescricao_UserControl(Paciente paciente, EnumTipoOperacao_Manipulacao tipo_operacao)
 {
     InitializeComponent();
     materialBLL                   = new MaterialBLL();
     this.paciente                 = paciente;
     this.medicamentoBLL           = new MedicamentoBLL();
     this.escalaBLL                = new EscalaBLL();
     this.diaSemanaBLL             = new DiaSemanaBLL();
     this.sal_MineralBLL           = new Sal_MineralBLL();
     this.prescricaoBLL            = new PrescricaoBLL();
     this.tipoOperacao_Manipulacao = tipo_operacao;
     CarregarDadosPadrao();
     prescricao = new Prescricao();
     list_Prescricao_Sal_Mineral = new List <Prescricao_Sal_Mineral>();
     listPrescricao_Material     = new List <Prescricao_Material>();
     listPrescricao_Medicamento  = new List <Prescricao_Medicamento>();
 }