private void grdBase_onSelectedDataRow(object sender, Control.GridView.RowEventArgs e) { Dictionary<string, object> dataKey = (Dictionary<string, object>)sender; Material entity = new Material(); entity.material_id = dataKey[DataKeyID].ToLong(); entity = ServiceProvider.MaterialService.FindByKeys(entity, false); this.ClosePopup(entity); }
public void grdBase_onLoadDataGrid(object sender, POS.Control.GridView.DataBindArgs e) { Material entity = new Material(); entity.material_code = txtMaterialCode.Text; entity.material_name = txtMaterialName.Text; grdBase.DataSourceDataSet = ServiceProvider.MaterialService.GetGridMaterial(entity); grdBase.DataKeyName = new string[] { DataKeyName }; }
private void LoadData() { Material entity = new Material(); if (mode == ObjectState.Edit && !string.IsNullOrEmpty(keyCode)) { entity.material_id = Converts.ParseLong(keyCode); entity = ServiceProvider.MaterialService.FindByKeys(entity, true); txtMaterialCode.Text = entity.material_code; txtMaterialName.Text = entity.material_name; txtMaterialDescription.Text = entity.material_description; cboMaterailGroup.SelectedValue = entity.material_group_id.ToString(); cboUOMReceive.SelectedValue = entity.uom_id_receive.ToString(); cboUOMCount.SelectedValue = entity.uom_id_count.ToString(); cboUOMUse.SelectedValue = entity.uom_id_use.ToString(); chkActive.Checked = entity.active; txtMaxStock.Text = entity.max_stock.ToString(); txtMinStock.Text = entity.min_stock.ToString(); txtShelfLife.Text = entity.shelf_life.ToString(); txtMaterialCost.Text = entity.material_cost.ToString(); txtAcceptableVariance.Text = entity.acceptable_variance.ToString(); if (entity.material_pic != null) { picMaterial.Image = Image.FromStream(new MemoryStream(entity.material_pic)); } else { picMaterial.Image = null; } } else { txtMaterialCode.Text = String.Empty; txtMaterialName.Text = String.Empty; txtMaterialDescription.Text = String.Empty; cboMaterailGroup.SelectedValue = String.Empty; cboUOMReceive.SelectedValue = String.Empty; cboUOMCount.SelectedValue = String.Empty; cboUOMUse.SelectedValue = String.Empty; chkActive.Checked = false; txtMaxStock.Text = String.Empty; txtMinStock.Text = String.Empty; txtShelfLife.Text = String.Empty; txtMaterialCost.Text = String.Empty; txtAcceptableVariance.Text = String.Empty; picMaterial.Image = null;//Image.FromStream(new MemoryStream(entity.material_pic)); } EnableMode(); }
private void grdBase_onLoadDataGrid(object sender, Control.GridView.DataBindArgs e) { Material entity = new Material(); entity.material_name = txtName.Text; entity.material_description = txtDesc.Text; entity.material_code = txtCode.Text; if (cbxGroup.SelectedIndex > 0) { entity.material_group_id = cbxGroup.SelectedValue.ToLong(); } grdBase.DataSourceDataSet = ServiceProvider.MaterialService.GetGridMaterial(entity); grdBase.DataKeyName = new string[] { DataKeyID }; grdBase.HiddenColumnName = new List<string>() { "ID", "Group Id", "Acceptable Variance", "Picture" }; //try to set its visibility this.grdBase.btnAddVisible = false; this.grdBase.btnDeleteVisible = false; this.grdBase.btnAddEnable = false; this.grdBase.btnDeleteEnable = false; grdBase.RearrangeButton(); }
private void txtMaterialCode_Leave(object sender, EventArgs e) { if (_originalMaterialCode != txtMaterialCode.Text) { Material entity = new Material(); entity.material_code = txtMaterialCode.Text; entity = ServiceProvider.MaterialService.FindByCode(entity, false); if (entity != null) { txtMaterialName.Text = entity.material_name; //txtLotNo.Text = this.GetLastLotNo().ToString(); UOM entityUOM = new UOM() { uom_id = entity.uom_id_receive.Value }; entityUOM = ServiceProvider.UOMService.FindByKeys(entityUOM, false); if (entityUOM != null) lblUOM.Text = entityUOM.uom_name; } else { txtMaterialName.Text = string.Empty; txtMaterialCode.Text = string.Empty; lblUOM.Text = string.Empty; } _originalMaterialCode = txtMaterialCode.Text; } }
private void SaveLots(TranDetail entityDetail, TranHead entityTranHead) { //get in_material Material entityMaterial = new Material() { material_id = entityDetail.material_id }; entityMaterial = ServiceProvider.MaterialService.FindByKeys(entityMaterial, false); //update into in_phy_lot PhyLot entityPhyLot = ServiceProvider.PhyLotService.GetPhyLot(entityDetail.material_id, entityDetail.warehouse_id_dest, entityDetail.lot_no.Value); entityPhyLot.bal_qty = (entityPhyLot.bal_qty + entityDetail.quantity.Value); entityPhyLot.expire_date = entityTranHead.transaction_date.AddDays(entityMaterial.shelf_life); ServiceProvider.PhyLotService.Update(entityPhyLot); //update into in_log_lot LogLot entityLogLot = ServiceProvider.LogLotService.GetLogLot(entityDetail.material_id, entityDetail.warehouse_id_dest); entityLogLot.bal_qty = (entityLogLot.bal_qty + entityDetail.quantity.Value); ServiceProvider.LogLotService.Update(entityLogLot); }
private Material GetData() { Material entity = new Material(); entity.material_id = Converts.ParseLong(keyCode); entity.material_group_id = Converts.ParseLong(cboMaterailGroup.SelectedValue.ToString()); entity.material_code = txtMaterialCode.Text; entity.material_name = txtMaterialName.Text; entity.material_description = txtMaterialDescription.Text; entity.uom_id_receive = Converts.ParseLong(cboUOMReceive.SelectedValue.ToString()); entity.uom_id_count = Converts.ParseLong(cboUOMCount.SelectedValue.ToString()); entity.uom_id_use = Converts.ParseLong(cboUOMUse.SelectedValue.ToString()); entity.period_group_id = null; //entity.phy_lot = txtMidName.Text; //entity.log_lot = txtLastName.Text; entity.active = chkActive.Checked; entity.status = null; entity.max_stock = Converts.ParseDecimal(txtMaxStock.Text); entity.min_stock = Converts.ParseDecimal(txtMinStock.Text); entity.shelf_life = Converts.ParseDouble(txtShelfLife.Text); entity.material_cost = Converts.ParseDecimal(txtMaterialCost.Text); entity.acceptable_variance = Converts.ParseDouble(txtAcceptableVariance.Text); if (picMaterial.Image != null) { MemoryStream ms = new MemoryStream(); picMaterial.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] buff = ms.GetBuffer(); entity.material_pic = buff; } else { entity.material_pic = null; } entity.created_by = "SYSTEM"; entity.created_date = DateTime.Now; entity.updated_by = "SYSTEM"; entity.updated_date = DateTime.Now; return entity; }
private void ValidationDetail(StockDetail entity) { ValidationResults results = new ValidationResults(); if (string.IsNullOrEmpty(txtAdjust.Text)) { ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IsRequired, "Adjust"), this, string.Empty, string.Empty, null); results.AddResult(result); } else if (Converts.ParseDecimalNullable(txtAdjust.Text) == null) { ValidationResult result = new ValidationResult(string.Format(ErrorMessage.IncorrectFormatOne, "Adjust"), this, string.Empty, string.Empty, null); results.AddResult(result); } else if (entity.bal_qty <= 0) { ValidationResult result = new ValidationResult(string.Format(ErrorMessage.CompareValueMore, "Adjust", "0"), this, string.Empty, string.Empty, null); results.AddResult(result); } else { Material entityMaterial = new Material() { material_id = entity.material_id }; entityMaterial = ServiceProvider.MaterialService.FindByKeys(entityMaterial, false); if (entity.bal_qty > entityMaterial.max_stock) { ValidationResult result = new ValidationResult(string.Format(ErrorMessage.CompareValueLessOrEqual, "Adjust", "Max Stock"), this, string.Empty, string.Empty, null); results.AddResult(result); } } if (results.Count > 0) { throw new ValidationException(results); } }