private void Update_LoginUser_From_View() { DataAccessPOS dbPOS = new DataAccessPOS(); //if (String.IsNullOrEmpty(txt_ConfigName.Text)) txt_ConfigName.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigValue.Text)) txt_ConfigValue.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigDesc.Text)) txt_ConfigDesc.Text = ""; if (DateTime.Parse(txt_CreatedDTTM.Text).Year < 2019) { txt_CreatedDTTM.Text = DateTime.Now.ToString(); } loginUsers.Clear(); loginUsers.Add(new POS_LoginUserModel() { Id = int.Parse(txt_LoginID.Text), FirstName = txt_FirstName.Text, LastName = txt_LastName.Text, NickName = txt_NickName.Text, Department = txt_Dept.Text, DOB = dtp_DOB.Value, MobilePhone = txt_Mobile.Text, Address = txt_Addr.Text, PassWord = txt_PassWord.Text, Grade = txt_Grade.Text, Wage = float.Parse(txt_Wage.Text), IsActive = check_Active.Checked, DateTimeCreated = Convert.ToDateTime(txt_CreatedDTTM.Text), DateTimeUpdated = DateTime.Now }); int iProdCnt = dbPOS.Update_LoginUser(loginUsers[0]); txtMessage.Text = "User successfully Updated : " + txt_LoginID.Text; txtMessage.ForeColor = Color.White; }
private void Insert_Promotion_From_View() { DataAccessPOS dbPOS = new DataAccessPOS(); //if (String.IsNullOrEmpty(txt_ConfigName.Text)) txt_ConfigName.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigValue.Text)) txt_ConfigValue.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigDesc.Text)) txt_ConfigDesc.Text = ""; int ipTypeId = 0; if (cb_PromoType.SelectedItem != null) { ppTypes = dbPOS.Get_PromoTypelkup_By_PromoTypeName(cb_PromoType.SelectedItem.ToString()); if (ppTypes.Count == 1) { ipTypeId = ppTypes[0].Id; } } ppromos.Clear(); ppromos.Add(new POS_PromotionModel() { Id = 0, PromoName = txt_PromoName.Text, PromoType = ipTypeId, PromoValue = float.Parse(txt_PromoValue.Text), PromoQTY = int.Parse(txt_PromoQTY.Text), PromoStartDttm = dttm_PromoStart.Value, PromoEndDttm = dttm_PromoEnd.Value }); int iCnt = dbPOS.Insert_Promotion(ppromos[0]); txtMessage.Text = "Promotion successfully Added : " + txt_PromoName.Text; txtMessage.ForeColor = Color.White; }
private bool UserLoginWithPassCode(string strPassCode) { DataAccessPOS dbPOS = new DataAccessPOS(); try { loginUsers = dbPOS.UserLogin(strPassCode); if (loginUsers.Count == 1) { if (Convert.ToInt32(loginUsers[0].Grade) < 2) { return(true); } else { //txtMessage.Text = "Login Failed ! Please check your grade !"; //strPassCode = string.Empty; //txtPassCode.Text = strPassCode; //Console.Beep(3000, 1000); util.Logger("UserLogin grade should be 0 or 1 : " + strPassCode + " (Grade = " + loginUsers[0].Grade + ")"); return(false); } } util.Logger("UserLogin Failed with PassCode :" + strPassCode); } catch (Exception e) { util.Logger("UserLogin Error :" + e.Message); return(false); } return(false); }
private void bt_Tax_Click(object sender, EventArgs e) { bt_Product.BackColor = Color.LightGreen; bt_LoginUser.BackColor = Color.Khaki; bt_ProdType.BackColor = Color.LightGreen; bt_RFIDTags.BackColor = Color.LightGreen; bt_Tax.BackColor = Color.Yellow; bt_SysConfig.BackColor = Color.Orchid; DataAccessPOS dbPOS = new DataAccessPOS(); taxs = dbPOS.Get_All_Tax(); isProduct = false; isLoginUser = false; isPType = false; isRFIDTag = false; isSysConfig = false; isTax = true; isStation = false; isPromotion = true; dgvData_Tax_Initialize(); if (taxs.Count > 0) { foreach (var tax in taxs) { this.dgvData.Rows.Add(new String[] { tax.Code, tax.Tax1.ToString(), tax.Tax2.ToString(), tax.Tax3.ToString() }); this.dgvData.FirstDisplayedScrollingRowIndex = dgvData.RowCount - 1; } } }
private void Load_LoginUser_Info(string strSelLoginId) { DataAccessPOS dbPOS = new DataAccessPOS(); loginUsers.Clear(); loginUsers = dbPOS.Get_LoginUser_By_ID(int.Parse(strSelLoginId)); if (loginUsers.Count == 1) { txt_LoginID.Text = loginUsers[0].Id.ToString(); txt_FirstName.Text = loginUsers[0].FirstName; txt_LastName.Text = loginUsers[0].LastName; txt_NickName.Text = loginUsers[0].NickName; txt_Dept.Text = loginUsers[0].Department; txt_Mobile.Text = loginUsers[0].MobilePhone; txt_Addr.Text = loginUsers[0].Address; try { dtp_DOB.Text = (loginUsers[0].DOB == null) ? "" : loginUsers[0].DOB.ToShortDateString(); } catch (Exception) { dtp_DOB.Text = DateTime.Now.ToShortDateString(); } txt_Addr.Text = loginUsers[0].Address; txt_PassWord.Text = loginUsers[0].PassWord; txt_Grade.Text = loginUsers[0].Grade; txt_Wage.Text = loginUsers[0].Wage.ToString(); txt_CreatedDTTM.Text = loginUsers[0].DateTimeCreated.ToString(); txt_UpdatedDTTM.Text = loginUsers[0].DateTimeUpdated.ToString(); check_Active.Checked = loginUsers[0].IsActive; } }
private void bt_SysConfig_Click(object sender, EventArgs e) { bt_Product.BackColor = Color.LightGreen; bt_LoginUser.BackColor = Color.Khaki; bt_ProdType.BackColor = Color.LightGreen; bt_RFIDTags.BackColor = Color.LightGreen; bt_Tax.BackColor = Color.DarkOrange; bt_SysConfig.BackColor = Color.Yellow; DataAccessPOS dbPOS = new DataAccessPOS(); sysconfs = dbPOS.Get_All_SysConfigs(); isProduct = false; isLoginUser = false; isPType = false; isRFIDTag = false; isSysConfig = true; isStation = true; isPromotion = false; dgvData_SysConfig_Initialize(); if (sysconfs.Count > 0) { foreach (var sysconf in sysconfs) { this.dgvData.Rows.Add(new String[] { sysconf.Id.ToString(), sysconf.ConfigName, sysconf.ConfigValue, sysconf.IsActive.ToString(), sysconf.ConfigDesc }); this.dgvData.FirstDisplayedScrollingRowIndex = dgvData.RowCount - 1; } } }
private void Load_AllProducts_DataGrid() { dgvDataFrom_Initialize(); DataAccessPOS dbPOS = new DataAccessPOS(); prods = dbPOS.Get_All_Products(); lbl_AllProds.Text = "All Products ( " + prods.Count.ToString() + " )"; if (prods.Count > 0) { foreach (var prod in prods) { this.dgvDataFrom.Rows.Add(new String[] { prod.Id.ToString(), dbPOS.Get_ProductTypeName_By_Id(prod.ProductTypeId), prod.ProductName, prod.OutUnitPrice.ToString() }); /* if (ptype.IsBatchDonation) * { * this.dgvData.Rows[dgvData.RowCount - 2].Cells[3].Style.BackColor = Color.Green; * } * if (ptype.IsBatchDiscount) * { * this.dgvData.Rows[dgvData.RowCount - 2].Cells[4].Style.BackColor = Color.Green; * }*/ this.dgvDataFrom.FirstDisplayedScrollingRowIndex = dgvDataFrom.RowCount - 1; } } }
private void Move_dgvDataFrom_dgvDataTo(string strSelProdId, double dblProdPrice) { DataAccessPOS dbPOS = new DataAccessPOS(); if (txt_PromoID.Text != "") { int iSelectedPromoId = Convert.ToInt32(txt_PromoID.Text); int iSelectedProdId = Convert.ToInt32(strSelProdId); double dblFirstProdPrice = dbPOS.Get_The_First_Product_Price_From_PromoProduct(iSelectedPromoId); if (dblFirstProdPrice > 0) { if (dblFirstProdPrice != dblProdPrice) { MessageBox.Show("Unit Price Should be the same! " + dblProdPrice.ToString() + " is Not Equal to " + dblFirstProdPrice.ToString()); return; } } pprods.Clear(); pprods.Add(new POS_PromoProductsModel() { PromoId = iSelectedPromoId, ProdId = Convert.ToInt32(strSelProdId) }); if (!dbPOS.Check_PromoProducts(pprods[0])) { dbPOS.Insert_PromoProduct(pprods[0]); } } //dgvDataFrom.Rows.RemoveAt(dgvDataFrom.SelectedRows[i].Index); }
private void Load_Existing_Orders() { int iIndex = 0; dgv_Orders_Initialize(); DataAccessPOS dbPOS = new DataAccessPOS(); orders = dbPOS.Get_Orders_by_Station(FrmSalesMain.strStation); if (orders.Count > 0) { //////////////////////////////////////////////// // Add the ordered item into datagrid view //////////////////////////////////////////////// isNewInvoice = true; iNewInvNo = orders[0].InvoiceNo; foreach (var order in orders) { iIndex++; float iAmount = 0; if (order.OrderCategoryId == 0) { iAmount = order.Quantity * order.OutUnitPrice; this.dgv_Orders.Rows.Add(new String[] { order.ProductId.ToString(), order.ProductName, order.Quantity.ToString(), order.OutUnitPrice.ToString("0.00"), //iAmount.ToString("0.00") order.Amount.ToString("0.00") }); } else if (order.OrderCategoryId > 0) // Discount { iAmount = order.Amount; this.dgv_Orders.Rows.Add(new String[] { order.ProductId.ToString(), order.ProductName, order.Quantity.ToString(), order.Amount.ToString("0.00"), //iAmount.ToString("0.00") order.Amount.ToString("0.00") }); } if (order.RFTagId > 0) { this.dgv_Orders.Rows[this.dgv_Orders.RowCount - 1].Tag = order.RFTagId; DataGridViewRow row = this.dgv_Orders.Rows[this.dgv_Orders.RowCount - 1]; row.DefaultCellStyle.ForeColor = Color.Blue; } else { this.dgv_Orders.Rows[this.dgv_Orders.RowCount - 1].Tag = null; } this.dgv_Orders.FirstDisplayedScrollingRowIndex = dgv_Orders.RowCount - 1; //this.dgv_Orders.FirstDisplayedScrollingRowIndex = Get_OrderedItem_Index_of_GridView(order.RFTagId); //this.dgv_Orders.Rows[Get_OrderedItem_Index_of_GridView(order.RFTagId)].Selected = true; // this.dgv_Orders.Rows[dgv_Orders.RowCount - 1].Selected = true; } } this.dgv_Orders.ClearSelection(); }
private void bt_Delete_Click(object sender, EventArgs e) { int iSelectedProdId = Convert.ToInt32(txt_ProdId.Text); if (iSelectedProdId > 0) { DataAccessPOS dbPOS = new DataAccessPOS(); dbPOS.Delete_Product_By_Id(iSelectedProdId); bt_Exit.PerformClick(); } }
private void bt_Save_Click(object sender, EventArgs e) { DataAccessPOS dbPOS = new DataAccessPOS(); if (String.IsNullOrEmpty(txt_ProdId.Text)) { Insert_Product_From_View(); } else { Update_Product_From_View(); } }
private void bt_RFIDTags_Click(object sender, EventArgs e) { bt_Product.BackColor = Color.LightGreen; bt_LoginUser.BackColor = Color.Khaki; bt_ProdType.BackColor = Color.LightGreen; bt_RFIDTags.BackColor = Color.Yellow; bt_Tax.BackColor = Color.DarkOrange; bt_SysConfig.BackColor = Color.Orchid; DataAccessPOS dbPOS = new DataAccessPOS(); rfids = dbPOS.Get_All_RFIDTags(); isProduct = false; isLoginUser = false; isPType = false; isRFIDTag = true; isSysConfig = false; isTax = false; isStation = false; isPromotion = false; dgvData_RFIDTags_Initialize(); if (rfids.Count > 0) { foreach (var rfid in rfids) { this.dgvData.Rows.Add(new String[] { rfid.Id.ToString(), dbPOS.Get_ProductName_By_Id(rfid.ProductId), rfid.SerialNo, rfid.IsUsed.ToString(), rfid.DateTimeRegistered.ToString(), rfid.DateTimeUsed.ToString(), rfid.DiscountRate.ToString(), rfid.IsDonation.ToString() }); if (rfid.IsUsed) { this.dgvData.Rows[dgvData.RowCount - 2].Cells[3].Style.BackColor = Color.Red; } if (rfid.IsDonation) { this.dgvData.Rows[dgvData.RowCount - 2].Cells[7].Style.BackColor = Color.Red; } if (rfid.DiscountRate > 0) { this.dgvData.Rows[dgvData.RowCount - 2].Cells[6].Style.BackColor = Color.Red; } this.dgvData.FirstDisplayedScrollingRowIndex = dgvData.RowCount - 1; } } }
private void Load_PromoType_Combo_Contents() { DataAccessPOS dbPOS = new DataAccessPOS(); ppTypes.Clear(); ppTypes = dbPOS.Get_All_PromoTypelkups(); if (ppTypes.Count > 0) { int i = 0; foreach (var pptype in ppTypes) { cb_PromoType.Items.Add(pptype.PromoTypeName); } } }
private void Load_SysConfig_Info(string strConfigID) { DataAccessPOS dbPOS = new DataAccessPOS(); sysCons.Clear(); sysCons = dbPOS.Get_SysConfig_By_ID(int.Parse(strConfigID)); if (sysCons.Count == 1) { txt_ConfigID.Text = sysCons[0].Id.ToString(); txt_ConfigName.Text = sysCons[0].ConfigName; txt_ConfigValue.Text = sysCons[0].ConfigValue; txt_ConfigDesc.Text = sysCons[0].ConfigDesc; check_IsActive.Checked = sysCons[0].IsActive; } }
private void Load_ProdType_Info(string strTypeId) { DataAccessPOS dbPOS = new DataAccessPOS(); ptypes.Clear(); ptypes = dbPOS.Get_ProductType_By_ID(int.Parse(strTypeId)); if (ptypes.Count == 1) { txt_TypeID.Text = ptypes[0].Id.ToString(); txt_TypeName.Text = ptypes[0].TypeName; check_Liquor.Checked = ptypes[0].IsLiquor; check_Restaurant.Checked = ptypes[0].IsRestaurant; check_Donation.Checked = ptypes[0].IsBatchDonation; check_Discount.Checked = ptypes[0].IsBatchDiscount; } }
private void dgvData_Promo_Initialize() { DataAccessPOS dbPOS = new DataAccessPOS(); this.dgvData.AutoSize = false; dgvData.Rows.Clear(); //this.dataGridActivity.AutoGenerateColumns = false; //this.dataGridActivity.RowHeadersVisible = false; //this.dataGridActivity.MultiSelect = false; this.dgvData.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.dgvData.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; this.dgvData.DefaultCellStyle.WrapMode = DataGridViewTriState.True; this.dgvData.ColumnCount = 7; this.dgvData.Columns[0].Name = "Id"; this.dgvData.Columns[0].Width = 50; this.dgvData.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; this.dgvData.Columns[1].Name = "Promotion Name"; this.dgvData.Columns[1].Width = 200; this.dgvData.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; this.dgvData.Columns[2].Name = "Promotion Type"; this.dgvData.Columns[2].Width = 120; this.dgvData.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; this.dgvData.Columns[3].Name = "Value"; this.dgvData.Columns[3].Width = 120; this.dgvData.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; this.dgvData.Columns[4].Name = "QTY"; this.dgvData.Columns[4].Width = 50; this.dgvData.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; this.dgvData.Columns[5].Name = "Start Date Time"; this.dgvData.Columns[5].Width = 200; this.dgvData.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; this.dgvData.Columns[6].Name = "End Date Time"; this.dgvData.Columns[6].Width = 200; this.dgvData.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; this.dgvData.DefaultCellStyle.Font = new Font("Arial", 16F, GraphicsUnit.Pixel); this.dgvData.EnableHeadersVisualStyles = false; this.dgvData.ColumnHeadersDefaultCellStyle.Font = new Font("Arial", 18F, GraphicsUnit.Pixel); this.dgvData.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; this.dgvData.ColumnHeadersDefaultCellStyle.BackColor = Color.LightBlue; // fix the row height dgvData.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; dgvData.AllowUserToResizeRows = false; dgvData.RowTemplate.Resizable = DataGridViewTriState.True; dgvData.RowTemplate.MinimumHeight = 40; }
private void Load_Product_Info(string strInProdID) { DataAccessPOS dbPOS = new DataAccessPOS(); prods.Clear(); prods = dbPOS.Get_Product_By_ID(int.Parse(strInProdID)); if (prods.Count == 1) { txt_ProdId.Text = prods[0].Id.ToString(); txt_ProductName.Text = prods[0].ProductName; txt_SecondName.Text = prods[0].SecondName; cb_ProdType.SelectedIndex = cb_ProdType.FindStringExact(dbPOS.Get_ProductTypeName_By_Id(prods[0].ProductTypeId)); txt_IUnitPrice.Text = prods[0].InUnitPrice.ToString(); txt_OUnitPrice.Text = prods[0].OutUnitPrice.ToString(); txt_PromPrice1.Text = prods[0].PromoPrice1.ToString(); txt_PromPrice2.Text = prods[0].PromoPrice2.ToString(); txt_PromPrice3.Text = prods[0].PromoPrice3.ToString(); checkTax1.Checked = prods[0].IsTax1; checkTax2.Checked = prods[0].IsTax2; checkTax3.Checked = prods[0].IsTax3; checkPRT1.Checked = prods[0].IsPrinter1; checkPRT2.Checked = prods[0].IsPrinter2; checkPRT3.Checked = prods[0].IsPrinter3; checkPRT4.Checked = prods[0].IsPrinter4; checkPRT5.Checked = prods[0].IsPrinter5; checkTaxInv.Checked = prods[0].IsTaxInverseCalculation; checkSoldOut.Checked = prods[0].IsSoldOut; dttm_PromStart.Text = prods[0].PromoStartDate.ToString(); dttm_PromEnd.Text = prods[0].PromoEndDate.ToString(); txt_Deposit.Text = prods[0].Deposit.ToString(); txt_RecyclingFee.Text = prods[0].RecyclingFee.ToString(); txt_ChillCharge.Text = prods[0].ChillCharge.ToString(); if (prods[0].MemoText == null) { txt_Memo.Text = ""; } else { txt_Memo.Text = prods[0].MemoText.ToString(); } //cb_PromDay1.Items[] //cb_PromDay2.Items[] //cb_PromDay3.Items[] } }
private void Load_Promotion_Info(string strPromoId) { DataAccessPOS dbPOS = new DataAccessPOS(); ppromos.Clear(); ppromos = dbPOS.Get_Promotion_By_ID(int.Parse(strPromoId)); if (ppromos.Count == 1) { txt_PromoID.Text = ppromos[0].Id.ToString(); txt_PromoName.Text = ppromos[0].PromoName; cb_PromoType.SelectedIndex = cb_PromoType.FindStringExact(dbPOS.Get_PromoTypelkupName_By_Id(ppromos[0].PromoType)); txt_PromoValue.Text = ppromos[0].PromoValue.ToString(); txt_PromoQTY.Text = ppromos[0].PromoQTY.ToString(); dttm_PromoStart.Text = ppromos[0].PromoStartDttm.ToString(); dttm_PromoEnd.Text = ppromos[0].PromoEndDttm.ToString(); } }
private void Insert_SysConfig_From_View() { DataAccessPOS dbPOS = new DataAccessPOS(); //if (String.IsNullOrEmpty(txt_ConfigName.Text)) txt_ConfigName.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigValue.Text)) txt_ConfigValue.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigDesc.Text)) txt_ConfigDesc.Text = ""; sysCons.Clear(); sysCons.Add(new POS_SysConfigModel() { //Id = int.Parse(txt_ConfigID.Text), ConfigName = txt_ConfigName.Text, ConfigValue = txt_ConfigValue.Text, ConfigDesc = txt_ConfigDesc.Text, IsActive = check_IsActive.Checked }); int iProdCnt = dbPOS.Insert_SysConfig(sysCons[0]); }
private void bt_ProdType_Click(object sender, EventArgs e) { bt_Product.BackColor = Color.LightGreen; bt_LoginUser.BackColor = Color.Khaki; bt_ProdType.BackColor = Color.Yellow; bt_RFIDTags.BackColor = Color.LightGreen; bt_Tax.BackColor = Color.DarkOrange; bt_SysConfig.BackColor = Color.Orchid; DataAccessPOS dbPOS = new DataAccessPOS(); ptypes = dbPOS.Get_All_ProductTypes(); isProduct = false; isLoginUser = false; isPType = true; isRFIDTag = false; isSysConfig = false; isTax = false; isStation = false; isPromotion = false; dgvData_ProdType_Initialize(); if (ptypes.Count > 0) { foreach (var ptype in ptypes) { this.dgvData.Rows.Add(new String[] { ptype.Id.ToString(), ptype.TypeName, ptype.IsLiquor.ToString(), ptype.IsBatchDonation.ToString(), ptype.IsBatchDiscount.ToString() }); if (ptype.IsBatchDonation) { this.dgvData.Rows[dgvData.RowCount - 2].Cells[3].Style.BackColor = Color.Green; } if (ptype.IsBatchDiscount) { this.dgvData.Rows[dgvData.RowCount - 2].Cells[4].Style.BackColor = Color.Green; } this.dgvData.FirstDisplayedScrollingRowIndex = dgvData.RowCount - 1; } } }
private bool Get_PinPad_Information() { DataAccessPOS dbPOS = new DataAccessPOS(); stations.Clear(); stations = dbPOS.Get_Station_By_Station(p_Station); if (stations.Count > 0) { text_IPADDR.Text = stations[0].IP_Addr; text_PortNo.Text = stations[0].IPS_Port.ToString(); return(Check_PinPad_Connectivity()); } else { text_IPADDR.Text = "192.168.1.189"; text_PortNo.Text = "7788"; } return(false); }
private void Move_dgvDataTod_gvDataFrom(string strSelProdId, int i) { DataAccessPOS dbPOS = new DataAccessPOS(); int iSelectedPromoId = Convert.ToInt32(txt_PromoID.Text); pprods.Clear(); pprods.Add(new POS_PromoProductsModel() { PromoId = iSelectedPromoId, ProdId = Convert.ToInt32(strSelProdId) }); if (dbPOS.Check_PromoProducts(pprods[0])) { dbPOS.Delete_PromoProducts(pprods[0]); } //dgvDataFrom.Rows.RemoveAt(dgvDataFrom.SelectedRows[i].Index); }
private void bt_Promotion_Click(object sender, EventArgs e) { //pnl_Product.Show(); //pnl_User.Hide(); bt_Product.BackColor = Color.Yellow; bt_LoginUser.BackColor = Color.Khaki; bt_ProdType.BackColor = Color.LightGreen; bt_RFIDTags.BackColor = Color.LightGreen; bt_Tax.BackColor = Color.DarkOrange; bt_SysConfig.BackColor = Color.Orchid; DataAccessPOS dbPOS = new DataAccessPOS(); promos = dbPOS.Get_All_Promotions(); isProduct = false; isLoginUser = false; isPType = false; isRFIDTag = false; isSysConfig = false; isTax = false; isStation = false; isPromotion = true; dgvData_Promo_Initialize(); if (promos.Count > 0) { foreach (var promo in promos) { this.dgvData.Rows.Add(new String[] { promo.Id.ToString(), promo.PromoName, promo.PromoType.ToString(), promo.PromoValue.ToString(), promo.PromoQTY.ToString(), promo.PromoStartDttm.ToString(), promo.PromoEndDttm.ToString() }); this.dgvData.FirstDisplayedScrollingRowIndex = dgvData.RowCount - 1; } } }
private void Update_Station_From_View() { DataAccessPOS dbPOS = new DataAccessPOS(); //if (String.IsNullOrEmpty(txt_ConfigName.Text)) txt_ConfigName.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigValue.Text)) txt_ConfigValue.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigDesc.Text)) txt_ConfigDesc.Text = ""; stations.Clear(); stations.Add(new POS_StationModel() { ComputerName = txt_HostName.Text, Station = txt_Station.Text, StationName = txt_StationName.Text, IP_Addr = txt_IPAddr.Text, StationNo = int.Parse(txt_StationNo.Text), IPS_Port = int.Parse(txt_IPS_Port.Text), Enabled = check_IsActive.Checked }); int iProdCnt = dbPOS.Update_Station(stations[0]); }
private bool UserLoginWithPassCode(string strPassCode) { DataAccessPOS dbPOS = new DataAccessPOS(); try { loginUsers = dbPOS.UserLogin(strPassCode); if (loginUsers.Count == 1) { return(true); } util.Logger("UserLogin Failed with PassCode :" + strPassCode); } catch (Exception e) { util.Logger("UserLogin Error :" + e.Message); return(false); } return(false); }
private void Load_PromoProducts_DataGrid() { dgvDataTo_Initialize(); if (txt_PromoID.Text != "") { DataAccessPOS dbPOS = new DataAccessPOS(); int iSelectedPromoId = Convert.ToInt32(txt_PromoID.Text); if (iSelectedPromoId > 0) { pprods = dbPOS.Get_PromoProducts_By_PromoId(iSelectedPromoId); lbl_SelectedProds.Text = "Selected Products ( " + pprods.Count.ToString() + " )"; if (pprods.Count > 0) { foreach (var pprod in pprods) { prods = dbPOS.Get_Product_By_ID(pprod.ProdId); if (prods.Count > 0) { this.dgvDataTo.Rows.Add(new String[] { prods[0].Id.ToString(), dbPOS.Get_ProductTypeName_By_Id(prods[0].ProductTypeId), prods[0].ProductName, prods[0].OutUnitPrice.ToString() }); /* if (ptype.IsBatchDonation) * { * this.dgvData.Rows[dgvData.RowCount - 2].Cells[3].Style.BackColor = Color.Green; * } * if (ptype.IsBatchDiscount) * { * this.dgvData.Rows[dgvData.RowCount - 2].Cells[4].Style.BackColor = Color.Green; * }*/ this.dgvDataTo.FirstDisplayedScrollingRowIndex = dgvDataTo.RowCount - 1; } } } } } }
private void Insert_ProdType_From_View() { DataAccessPOS dbPOS = new DataAccessPOS(); //if (String.IsNullOrEmpty(txt_ConfigName.Text)) txt_ConfigName.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigValue.Text)) txt_ConfigValue.Text = ""; //if (String.IsNullOrEmpty(txt_ConfigDesc.Text)) txt_ConfigDesc.Text = ""; ptypes.Clear(); ptypes.Add(new POS_ProductTypeModel() { TypeName = txt_TypeName.Text, IsLiquor = check_Liquor.Checked, IsRestaurant = check_Restaurant.Checked, IsBatchDonation = check_Donation.Checked, IsBatchDiscount = check_Discount.Checked }); int iCnt = dbPOS.Insert_ProductType(ptypes[0]); txtMessage.Text = "Type successfully Added : " + txt_TypeName.Text; txtMessage.ForeColor = Color.White; }
private void bt_LoginUser_Click(object sender, EventArgs e) { bt_Product.BackColor = Color.LightGreen; bt_LoginUser.BackColor = Color.Yellow; bt_ProdType.BackColor = Color.LightGreen; bt_RFIDTags.BackColor = Color.LightGreen; bt_Tax.BackColor = Color.DarkOrange; bt_SysConfig.BackColor = Color.Orchid; DataAccessPOS dbPOS = new DataAccessPOS(); loginUsers = dbPOS.Get_All_LoginUsers(); isProduct = false; isLoginUser = true; isPType = false; isRFIDTag = false; isSysConfig = false; isTax = false; isStation = false; isPromotion = false; dgvData_LoginUser_Initialize(); if (loginUsers.Count > 0) { foreach (var loginUser in loginUsers) { this.dgvData.Rows.Add(new String[] { loginUser.Id.ToString(), loginUser.FirstName, loginUser.LastName, loginUser.PassWord, loginUser.Grade }); if (Convert.ToInt32(loginUser.Grade) < 2) { this.dgvData.Rows[dgvData.RowCount - 2].Cells[4].Style.BackColor = Color.Green; } this.dgvData.FirstDisplayedScrollingRowIndex = dgvData.RowCount - 1; } } }
private void Get_SysConfig_TaxTitle() { DataAccessPOS dbPOS = new DataAccessPOS(); sysConfs.Clear(); sysConfs = dbPOS.Get_SysConfig_By_Name("Tax1"); if (sysConfs.Count == 1) { checkTax1.Text = sysConfs[0].ConfigValue; } sysConfs.Clear(); sysConfs = dbPOS.Get_SysConfig_By_Name("Tax2"); if (sysConfs.Count == 1) { checkTax2.Text = sysConfs[0].ConfigValue; } sysConfs.Clear(); sysConfs = dbPOS.Get_SysConfig_By_Name("Tax3"); if (sysConfs.Count == 1) { checkTax3.Text = sysConfs[0].ConfigValue; } }
private void Load_Station_Info(string strHostName) { DataAccessPOS dbPOS = new DataAccessPOS(); stations.Clear(); stations = dbPOS.Get_Station_By_HostName(strHostName); if (stations.Count == 1) { txt_HostName.Text = stations[0].ComputerName; txt_Station.Text = stations[0].Station; txt_StationName.Text = stations[0].StationName; txt_IPAddr.Text = stations[0].IP_Addr; txt_IPS_Port.Text = stations[0].IPS_Port.ToString(); if (stations[0].Enabled) { check_IsActive.Checked = true; } else { check_IsActive.Checked = false; } } }