public List <MasItemDTO> GetSearchItem() { List <MasItemDTO> lst = new List <MasItemDTO>(); try { List <SqlParameter> param = new List <SqlParameter>(); DataSet ds = conn.GetDataSet("GetSearchItem", param); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null) { MasItemDTO o = new MasItemDTO(); foreach (DataRow dr in ds.Tables[0].Rows) { o = new MasItemDTO(); o.ItemID = Convert.ToInt32(dr["ItemID"].ToString()); o.ItemCode = dr["ItemCode"].ToString(); o.ItemName = dr["ItemName"].ToString(); o.ItemDesc = dr["ItemDesc"].ToString(); o.ItemPrice = Convert.ToDouble(dr["ItemPrice"].ToString()); o.UnitName = dr["UnitName"].ToString(); o.Active = dr["Active"].ToString(); lst.Add(o); } } } catch (Exception ex) { } return(lst); }
public List <TransStock> CheckRemainingItem(Int32 ItemID) { List <TransStock> lst = new List <TransStock>(); try { List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter() { ParameterName = "ItemID", Value = ItemID, DbType = DbType.Int32 }); DataSet ds = conn.GetDataSet("GetItemRemaining", param); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null) { TransStock o = new TransStock(); foreach (DataRow dr in ds.Tables[0].Rows) { o = new TransStock(); o.StockID = Convert.ToInt32(dr["StockID"].ToString()); o.ItemID = Convert.ToInt32(dr["ItemID"].ToString()); o.Serial = dr["Serial"].ToString(); o.SaleHeaderID = Convert.ToInt32(dr["SaleHeaderID"].ToString()); o.SaleDetailID = Convert.ToInt32(dr["SaleDetailID"].ToString()); o.Active = dr["Active"].ToString(); lst.Add(o); } } } catch (Exception ex) { } return(lst); }
public List <SaleHeaderDTO> GetSearchCustomer(string CusName) { List <SaleHeaderDTO> lst = new List <SaleHeaderDTO>(); try { List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter() { ParameterName = "CustomerName", Value = CusName }); DataSet ds = conn.GetDataSet("GetCustomerHistorty", param); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null) { SaleHeaderDTO o = new SaleHeaderDTO(); foreach (DataRow dr in ds.Tables[0].Rows) { o = new SaleHeaderDTO(); o.SaleHeaderID = Convert.ToInt32(dr["SaleHeaderID"].ToString()); o.CustomerName = dr["CustomerName"].ToString(); o.Tel = dr["Tel"].ToString(); if (dr["ReceivedDate"].ToString() != "") { o.ReceivedDate = Convert.ToDateTime(dr["ReceivedDate"].ToString()); } o.ReceivedBy = dr["ReceivedBy"].ToString(); o.SaleNumber = dr["SaleNumber"].ToString(); o.ItemCode = dr["ItemCode"].ToString(); o.ItemName = dr["ItemName"].ToString(); o.ItemID = dr["ItemID"].ToString() == "" ? 0 : Convert.ToInt32(dr["ItemID"].ToString()); o.dAmount = Convert.ToDouble(dr["Amount"].ToString()); o.ItemPrice = Convert.ToDouble(dr["ItemPrice"].ToString()); o.Discount = Convert.ToDouble(dr["Discount"].ToString()); o.SerialNumber = dr["SerialNumber"].ToString(); o.BillType = dr["BillType"].ToString(); lst.Add(o); } } } catch (Exception ex) { } return(lst); }
public MasPackageHeader GetSearchMasPackageHeaderByCode(string PackageCode) { MasPackageHeader item = new MasPackageHeader(); try { List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter() { ParameterName = "PackageCode", Value = PackageCode, DbType = DbType.String }); DataSet ds = conn.GetDataSet("GetMasPackageHeaderByCode", param); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null) { foreach (DataRow dr in ds.Tables[0].Rows) { item.PackageHeaderID = Convert.ToInt32(dr["PackageHeaderID"].ToString()); item.PackageCode = dr["PackageCode"].ToString(); item.PackageName = dr["PackageName"].ToString(); item.Active = dr["Active"].ToString(); item.PurchasePrice = !dr.IsNull("PurchasePrice") ? Convert.ToDouble(dr["PurchasePrice"].ToString()) : 0; item.SellPrice = Convert.ToDouble(dr["SellPrice"].ToString()); item.CreatedBy = dr["CreatedBy"].ToString(); item.CreatedDate = Convert.ToDateTime(dr["CreatedDate"].ToString()); item.UpdatedBy = dr["UpdatedBy"].ToString(); item.UpdatedDate = Convert.ToDateTime(dr["UpdatedDate"].ToString()); item.DMLFlag = "U"; break; } } } catch (Exception ex) { } return(item); }
public MasProduct GetSearchProductID(Int32 ProductID) { MasProduct item = new MasProduct(); try { List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter() { ParameterName = "ProductID", Value = ProductID, DbType = DbType.Int32 }); DataSet ds = conn.GetDataSet("GetProductByID", param); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null) { foreach (DataRow dr in ds.Tables[0].Rows) { item.ProductID = Convert.ToInt32(dr["ProductID"].ToString()); item.ProductCode = dr["ProductCode"].ToString(); item.ProductName = dr["ProductName"].ToString(); item.Active = dr["Active"].ToString(); item.PurchasePrice = string.IsNullOrEmpty(dr["PurchasePrice"].ToString()) ? 0 : Convert.ToDouble(dr["PurchasePrice"].ToString()); item.SellPrice = string.IsNullOrEmpty(dr["SellPrice"].ToString()) ? 0 : Convert.ToDouble(dr["SellPrice"].ToString()); item.CreatedBy = dr["CreatedBy"].ToString(); item.CreatedDate = Convert.ToDateTime(dr["CreatedDate"].ToString()); item.UpdatedBy = dr["UpdatedBy"].ToString(); item.UpdatedDate = Convert.ToDateTime(dr["UpdatedDate"].ToString()); item.UnitID = string.IsNullOrEmpty(dr["UnitID"].ToString()) ? 0 : Convert.ToInt32(dr["UnitID"].ToString()); item.TypeID = string.IsNullOrEmpty(dr["TypeID"].ToString()) ? 0 : Convert.ToInt32(dr["TypeID"].ToString()); item.ProductSN = dr["ProductSN"].ToString(); break; } } } catch (Exception ex) { } return(item); }
public List <ReportSaleMonthDTO> GetSearchReportSaleMonth(DateTime dateFrom, DateTime dateTo, double vat, double mm200, double mm225) { List <ReportSaleMonthDTO> lst = new List <ReportSaleMonthDTO>(); try { List <SqlParameter> param = new List <SqlParameter>(); param.Add(new SqlParameter() { ParameterName = "DateFrom", Value = dateFrom, DbType = DbType.DateTime }); param.Add(new SqlParameter() { ParameterName = "DateTo", Value = dateTo, DbType = DbType.DateTime }); DataSet ds = conn.GetDataSet("GetReportSaleMonth", param); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null) { foreach (DataRow dr in ds.Tables[0].Rows) { ReportSaleMonthDTO item = new ReportSaleMonthDTO(); item.HeaderID = Convert.ToInt32(dr["SaleHeaderID"].ToString()); item.Remark = dr["Remark"].ToString(); item.CustomerName = dr["CustomerName"].ToString(); item.CustomerAddress = dr["CustomerAddress"].ToString(); item.CustomerDistrict = dr["CustomerDistrict"].ToString(); item.CustomerCountry = dr["CustomerCountry"].ToString(); item.CustomerProvince = dr["CustomerProvince"].ToString(); item.CustomerPostalCode = dr["CustomerPostalCode"].ToString(); item.ReceivedDate = Convert.ToDateTime(dr["ReceivedDate"].ToString()); item.WarrantyDate = Convert.ToDateTime(dr["WarrantyDate"].ToString()); item.SaleNumber = dr["SaleNumber"].ToString(); if (!string.IsNullOrEmpty(dr["SaleDetailID"].ToString())) { item.DetailID = Convert.ToInt32(dr["SaleDetailID"].ToString()); item.ItemCode = dr["PackageCode"].ToString(); item.ItemName = dr["PackageName"].ToString(); item.ItemDescription = dr["ItemDetail"].ToString(); item.ItemPrice = Convert.ToDouble(dr["ItemPrice"].ToString()); item.Discount = Convert.ToDouble(dr["Discount"].ToString()); item.Amount = Convert.ToDouble(dr["Amount"].ToString()); } item.SerialNumber = dr["SerialNumber"].ToString(); item.Tel = dr["Tel"].ToString(); item.Address = dr["CustomerAddress"].ToString(); item.District = dr["CustomerDistrict"].ToString(); item.Country = dr["CustomerCountry"].ToString(); item.Province = dr["CustomerProvince"].ToString(); item.PostalCode = dr["CustomerPostalCode"].ToString(); item.PayTypeID = dr["PayType"].ToString(); item.BillTypeID = dr["BillType"].ToString(); item.VAT = vat; item.MAXMIG200 = mm200; item.MAXMIG225 = mm225; item.VisImgBtn = "true"; item.ConsignmentNo = dr["ConsignmentNo"].ToString(); item.AccountTransfer = dr["AccountTransfer"].ToString(); item.Installment = dr["Installment"].ToString(); item.Active = dr["Active"].ToString(); item.Remove = "N"; lst.Add(item); } } } catch (Exception ex) { } return(lst); }