private void AddProductRecord()
        {
            // can only add a new product record
            if (Entity != EntityType.ProductRecord)
            {
                return;
            }
            if (!CheckFields())
            {
                return;
            }

            var newProduct = new ProductModel()
            {
                Name         = formProductName.Text,
                Description  = formProductDescription.Text,
                UnitPrice    = (decimal)formProductPricePerUnit.Value,
                UnitsInStock = (int)formProductStockCount.Value,
                UnitCost     = (decimal)formProductUnitCost.Value
            };

            if (DBAccessHelper.AddProduct(newProduct))
            {
                MessageBox.Show("Your product was added!", "Product added", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("Your product was not added!", "Error: Product not added", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private bool SaveCustomerChanges()
        {
            if (!CheckFields())
            {
                return(false);
            }

            var changedModel = new CustomerModel()
            {
                ID           = ((CustomerModel)selectedRow).ID,
                FirstName    = formCustomerFirstNameTextbox.Text.Trim(),
                LastName     = formCustomerLastNameTextbox.Text.Trim(),
                PhoneNumber  = formCustomerPhoneNumberTextbox.Text.Trim(),
                EmailAddress = formCustomerEmailAddressTextbox.Text.Trim(),
                Address      = $"{formCustomerHouseNumberNameTextbox.Text.Trim()}|{formCustomerPostCodeTextbox.Text.Trim()}"
            };

            bool changeEmail = customerPasswordTb.Visibility == Visibility.Visible;

            if (changeEmail)
            {
                if (formCustomerPasswordbox.Password == string.Empty)
                {
                    MessageBox.Show("You need to input the customer's password to change their email.", "No password entered!");
                }
                else
                {
                    return(DBAccessHelper.AlterUser(changedModel, ((CustomerModel)selectedRow).EmailAddress, formCustomerPasswordbox.Password));
                }
            }

            return(DBAccessHelper.AlterUser(changedModel));
        }
        private void StaffSetup()
        {
            pageName.Text = "Entity Editor - Staff Records";
            bool canAccessEmployees = Staff.Can(StaffModel.Permission.AccessEmployeeData);

            // need get staff function
            dataSource = DBAccessHelper.GetStaff(canAccessEmployees);
            if (dataSource == null)
            {
                dataSource = new DataTable()
                {
                    Columns =
                    {
                        { "error"           },
                        { "no values found" }
                    }
                }
            }
            ;
            resultDg.ItemsSource = dataSource.AsDataView();
            resultDg.Visibility  = form.Visibility = formEmployeeData.Visibility =
                deleteSelectedRecord.Visibility = saveFormChanges.Visibility = Visibility.Visible;

            addNewRecord.Visibility = Visibility.Collapsed;
        }
        private void DeleteStaffRecord()
        {
            if (!CheckFields())
            {
                return;
            }
            if (!Staff.Can(StaffModel.Permission.AccessEmployeeData))
            {
                MessageBox.Show("You do not have the correct permissions to perform this action!");
                return;
            }
            var employee = ((StaffModel)selectedRow);

            bool result = DBAccessHelper.DeleteUser(employee.ID);

            // delete failed
            if (!result)
            {
                MessageBox.Show("Record could not be deleted!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            // delete was a success
            ClearForm();
        }
예제 #5
0
        public int UpdatePassword(UserDetailsEntity Obj)
        {
            int UserID = 0;

            try
            {
                using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPUPDAGEUSERDETAILS))
                {
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamUserId, DbType.Int32, Obj.intUserId);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamPhoneNumber, DbType.Int64, Obj.BigIntPhoneNumber);

                    IDataReader dr = DBAccessHelper.ExecuteReader(objDbCommand);
                    while (dr.Read())
                    {
                        UserID = Convert.ToInt32(dr[DataAccessConstants.ParamUserId]);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLoggin("ManagementDal", "UpdatePassword", ex.Message);
            }

            return(UserID);
        }
예제 #6
0
        private void BtnExecuteCommand_OnClick(object sender, RoutedEventArgs e)
        {
            string strConn = string.Format("Data Source={0},{1};Initial Catalog={2};User Id={3};Password={4}"
                                           , "192.168.4.181", 1433, "UMPDataDB0319", "VCLogIMP", "imp_123");
            string strSql = string.Format("delete from T_11_701_OL");

            SubDebug(string.Format("Executing command..."));
            mWorker         = new BackgroundWorker();
            mWorker.DoWork += (s, de) =>
            {
                OperationReturn optReturn = DBAccessHelper.ExecuteCommand(strConn, strSql);
                if (!optReturn.Result)
                {
                    SubDebug(string.Format("Fail.\t{0}", optReturn));
                }
                else
                {
                    SubDebug(string.Format("End\t{0}", optReturn.IntValue));
                }
            };
            mWorker.RunWorkerCompleted += (s, re) =>
            {
                mWorker.Dispose();
                mWorker = null;
            };
            mWorker.RunWorkerAsync();
        }
예제 #7
0
        public UserDetailsEntity VerifyMobileNumber(UserDetailsEntity Obj)
        {
            UserDetailsEntity Entity = new UserDetailsEntity();

            try
            {
                using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPVERIFYMOBILENUMBER))
                {
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamPhoneNumber, DbType.String, Obj.BigIntPhoneNumber);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.PARAMOTP, DbType.String, Obj.OTP);
                    IDataReader dr = DBAccessHelper.ExecuteReader(objDbCommand);
                    while (dr.Read())
                    {
                        Entity.txtName           = Convert.ToString(dr[DataAccessConstants.ParamtName]);
                        Entity.intUserId         = Convert.ToInt32(dr[DataAccessConstants.ParamUserId]);
                        Entity.BigIntPhoneNumber = Convert.ToInt64(dr[DataAccessConstants.ParamPhoneNumber]);
                        Entity.txtPassword       = Convert.ToString(dr[DataAccessConstants.ParamPasswordd]);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLoggin("ManagementDal", "VerifyMobileNumber", ex.Message);
                return(null);
            }

            return(Entity);
        }
예제 #8
0
        public int UPDATEOTP(UserDetailsEntity Obj)
        {
            int OTP = 0;

            try
            {
                using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPUPDATEOTP))
                {
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamPhoneNumber, DbType.String, Obj.BigIntPhoneNumber);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.PARAMOTP, DbType.String, Obj.OTP);
                    IDataReader dr = DBAccessHelper.ExecuteReader(objDbCommand);
                    while (dr.Read())
                    {
                        OTP = Convert.ToInt32(dr[DataAccessConstants.PARAMOTP]);
                    }
                    string         URL     = "https://2factor.in/API/V1/a2cbd769-9ef3-11e8-a895-0200cd936042/SMS/" + Obj.BigIntPhoneNumber + "/" + Obj.OTP + "/RaiteRajuOTP";
                    HttpWebRequest request = WebRequest.Create(URL) as HttpWebRequest;
                    //optional
                    HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                    Stream          stream   = response.GetResponseStream();
                }
            }
            catch (Exception ex)
            {
                ExceptionLoggin("ManagementDal", "UPDATEOTP", ex.Message);
            }

            return(OTP);
        }
예제 #9
0
 /// <summary>
 /// 通过身份证查询学员信息
 /// </summary>
 /// <param name="sPidNo"></param>
 public void SearchTraineeByPidNo()
 {
     m_trainMangeDataSet.TraineeDataTable.Clear();
     DBAccessHelper.GetTraStudInfoByPidNo(Trainee.m_sPidNo, m_trainMangeDataSet);
     if (m_trainMangeDataSet.TraineeDataTable.Rows.Count > 0)
     {
         DataRow dataRow = m_trainMangeDataSet.TraineeDataTable.Rows[0];
         Trainee.m_sName = dataRow["TRAINE_NAME"].ToString();
         if (dataRow["PHOTO"].ToString() != "" && dataRow["PHOTO"] != null)
         {
             Trainee.m_sPhoto = (byte[])dataRow["PHOTO"];
         }
         else
         {
             Trainee.m_sPhoto = null;
         }
         Trainee.m_sSex          = dataRow["SEX"].ToString();
         Trainee.m_sBirthDate    = Convert.ToDateTime(dataRow["BIRTH_DT"].ToString());
         Trainee.m_sFingerprint  = dataRow["FINGERPRINT1"].ToString();
         Trainee.m_sDrvSchoolId  = Convert.ToInt32(dataRow["DRIVING_SCHOOL_ID"].ToString());
         Trainee.m_sPhoneNo      = dataRow["PHONE_NO"].ToString();
         Trainee.m_sRegDate      = dataRow["FILLIN_TIME"].ToString();
         Trainee.m_sTrainerNo    = dataRow["TRAINER_ID"].ToString();
         Trainee.m_sAutoType     = dataRow["LICENSE_TYPE_CD"].ToString();
         Trainee.m_sTrainingMode = dataRow["TRAINING_MODE"].ToString();
         Trainee.m_nBalance      = Convert.ToDouble(dataRow["BALANCE"].ToString());
         Trainee.m_sHomeAddress  = dataRow["HOMEADDRESS"].ToString();
     }
 }
예제 #10
0
        public int InsertAdPostByAdmin(AdDetailsEntity Obj)
        {
            int AddId = 0;

            try
            {
                using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPAdPostByAdmin))
                {
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamAdCategory, DbType.String, Obj.Category);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamAdDescription, DbType.String, Obj.AdDescription);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamSubCategoryName, DbType.String, Obj.txtSubCategoryName);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamPrice, DbType.Int32, Obj.Price);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamQuantity, DbType.Int32, Obj.Quantity);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamSellingUnit, DbType.String, Obj.SellingUnit);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamPhoneNumber, DbType.String, Obj.MobileNumber);

                    IDataReader dr = DBAccessHelper.ExecuteReader(objDbCommand);
                    while (dr.Read())
                    {
                        AddId = Convert.ToInt32(dr[DataAccessConstants.ParamAdId]);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLoggin("ManagementDal", "InsertAddPostDetails", ex.Message);
                return(0);
            }
            return(AddId);
        }
예제 #11
0
        public int UploadImage(AdDetailsEntity Obj)
        {
            int AddId = 0;

            try
            {
                using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPUPLOADIMAGE))
                {
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.PARAMPHOTO, DbType.Binary, Obj.Image);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamAdId, DbType.Int32, Obj.AdID);
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamUserId, DbType.Int32, Obj.UserID);
                    IDataReader dr = DBAccessHelper.ExecuteReader(objDbCommand);
                    while (dr.Read())
                    {
                        AddId = Convert.ToInt32(dr[DataAccessConstants.ParamAdId]);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLoggin("ManagementDal", "UploadImage", ex.Message);
                return(0);
            }
            return(AddId);
        }
        private void MakeStaffButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Staff.Can(StaffModel.Permission.AccessEmployeeData))
            {
                MessageBox.Show("You do not have permission to do this!", "Not Authorised!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (selectedRow == null)
            {
                return;
            }

            CustomerModel selected = selectedRow as CustomerModel;

            var toStaff = new StaffModel()
            {
                ID           = selected.ID,
                FirstName    = selected.FirstName,
                LastName     = selected.LastName,
                PhoneNumber  = selected.PhoneNumber,
                EmailAddress = selected.EmailAddress,
                Address      = selected.Address
            };

            toStaff.Permissions = DBAccessHelper.CalculatePermissions(1);
            DBAccessHelper.AlterStaff(toStaff, 1);
        }
예제 #13
0
        private void BtnGetDataSet_OnClick(object sender, RoutedEventArgs e)
        {
            string strConn = string.Format("Data Source={0},{1};Initial Catalog={2};User Id={3};Password={4}"
                                           , "192.168.4.181", 1433, "UMPDataDB0319", "VCLogIMP", "imp_123");
            string strSql = string.Format("select top 200 * from T_21_000");

            SubDebug(string.Format("Getting data..."));
            mWorker         = new BackgroundWorker();
            mWorker.DoWork += (s, de) =>
            {
                OperationReturn optReturn = DBAccessHelper.GetDataSet(strConn, strSql);
                if (!optReturn.Result)
                {
                    SubDebug(string.Format("Fail.\t{0}", optReturn));
                }
                else
                {
                    DataSet objDS = optReturn.Data as DataSet;
                    if (objDS == null)
                    {
                        SubDebug(string.Format("DataSet is null"));
                    }
                    else
                    {
                        SubDebug(string.Format("End.\t{0}", objDS.Tables[0].Rows.Count));
                    }
                }
            };
            mWorker.RunWorkerCompleted += (s, re) =>
            {
                mWorker.Dispose();
                mWorker = null;
            };
            mWorker.RunWorkerAsync();
        }
        private void ConfirmPaymentButton_Click(object sender, RoutedEventArgs e)
        {
            bool items        = Order.Basket.Count != 0;
            bool deliverySet  = (rbCollection.IsChecked ?? false) || (rbHomeDelivery.IsChecked ?? false);
            bool correctInput = items & deliverySet;

            if (!correctInput)
            {
                string output = string.Empty;
                if (!items)
                {
                    output += "You need to add items to your basket to checkout!\n";
                }
                if (!deliverySet)
                {
                    output += "Please select a delivery option";
                }
                MessageBox.Show(output);
                return;
            }

            // if guest get address
            if (Order.User.ID == 0)
            {
                Window window = new GetGuestAddressWindow(this);
                bool   result = window.ShowDialog() ?? false;
                if (!result)
                {
                    return;
                }
            }

            // if the user is a customer, get confirmation of payment from a staff member
            if (!Order.User.IsStaff)
            {
                Window window = new StaffConfirmAction();
                bool   result = window.ShowDialog() ?? false;
                // if the action is cancelled
                if (!result)
                {
                    return;
                }
            }
            // enter order into the db
            Order.PaymentMethod = (selectedPaymentMethod.SelectedIndex == 0) ? OrderModel.PaymentType.Card : OrderModel.PaymentType.Cash;

            if (DBAccessHelper.ProcessOrder(Order))
            {
                MessageBox.Show("Payment saved!");
                Order.Basket.Items.Clear();
                confirmPaymentButton.IsEnabled  = false;
                confirmPaymentButton.Visibility = Visibility.Collapsed;
            }
            else
            {
                MessageBox.Show("Payment could not be saved!");
            }
        }
 private void DeleteOrderViewerButton_Click(object sender, RoutedEventArgs e)
 {
     if (DBAccessHelper.DeleteOrder(Order))
     {
         MessageBox.Show("Your order was deleted!");;
         caller.OrderViewerClosingUpdateOrderDisplay();
         Close();
     }
 }
예제 #16
0
        public void ExceptionLoggin(string ControllerName, string ActionName, string ErrorMessage)
        {
            using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPEXCEPTIONLOGGING))
            {
                DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamControllerName, DbType.String, ControllerName);
                DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamActionName, DbType.String, ActionName);
                DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamExceptionMessage, DbType.String, ErrorMessage);

                DBAccessHelper.ExecuteNonQuery(objDbCommand);
            }
        }
예제 #17
0
        private void GuestButton_Click(object sender, RoutedEventArgs e)
        {
            CustomerModel guest = (CustomerModel)DBAccessHelper.GetUser("guest@guest", "guest");
            OrderModel    order = new OrderModel()
            {
                ID   = 0,
                User = guest
            };

            ChangePageTo(new SearchProductsPage(order));
        }
예제 #18
0
 /// <summary>
 /// 获取训练扣分详细信息
 /// </summary>
 public void getTraProcessInfoPoints(int seqNo)
 {
     try
     {
         TrainMangeDataSet.TraProcessPointsDataTable.Clear();
         DBAccessHelper.GetTraProcessPoints(seqNo, TrainMangeDataSet);
     }
     catch (Exception e)
     {
         System.Windows.MessageBox.Show("获取学员训练信息出错,错误内容:" + e.Message.ToString());
     }
 }
예제 #19
0
 /// <summary>
 /// 获取训练过程信息
 /// </summary>
 public void getTraProcessInfo(string sExamCd, string CarType, string sTrainerId, int iDrvSchoolId, string dStartTs, string dEndTs, string TraName, string sPidNo, string autoid, int traBookSeqNo)
 {
     try
     {
         TrainMangeDataSet.TraProcessInfoDataTable.Clear();
         DBAccessHelper.GetTraProcess(sExamCd, CarType, sTrainerId, iDrvSchoolId, dStartTs, dEndTs, TraName, sPidNo, autoid, traBookSeqNo, TrainMangeDataSet);
     }
     catch (Exception e)
     {
         System.Windows.MessageBox.Show("获取学员训练信息出错,错误内容:" + e.Message.ToString());
     }
 }
예제 #20
0
 /// <summary>
 /// 获取指定学员许可信息
 /// </summary>
 public void getTraTrainLicense(string sBookSeqNo, string sPidNo)
 {
     try
     {
         TrainMangeDataSet.TraTrainLicenseDataTable.Clear();
         DBAccessHelper.getTrainLicense(int.Parse(sBookSeqNo), sPidNo, TrainMangeDataSet);
     }
     catch (Exception e)
     {
         System.Windows.MessageBox.Show("获取学员许可信息出错,错误内容:" + e.Message.ToString());
     }
 }
예제 #21
0
 /// <summary>
 /// 获取指定学员信息
 /// </summary>
 public void getTraStudinfoBySeqNo(double dSeqNo)
 {
     try
     {
         TrainMangeDataSet.TraineeDataTable.Clear();
         DBAccessHelper.GetTraStudInfoBySeqNo(dSeqNo, TrainMangeDataSet);
     }
     catch (Exception e)
     {
         System.Windows.MessageBox.Show("获取学员信息出错,错误内容:" + e.Message.ToString());
     }
 }
예제 #22
0
 private void btnLogin_Click(object sender, RoutedEventArgs e)
 {
     if (!ChkOCDBLink(DBAccessProc.Common.DBConnectionString))
     {
         MessageBox.Show("数据库连接失败,请检查网络或配置");
         return;
     }
     try
     {
         if (txtExaminerId.Text.Trim() == "")
         {
             MessageBox.Show("请输入考试员/操作员编号!");
             return;
         }
         if (txtPassword.Password.Trim() == "")
         {
             MessageBox.Show("请输入密码!");
             return;
         }
         DBAccessHelper.GetExaminer(txtExaminerId.Text.Trim().ToUpper(), txtPassword.Password.Trim(), dsrsrc.trainMangeDataSet);
         if (dsrsrc.trainMangeDataSet.TraManagerDataTable.Rows.Count == 0)
         {
             MessageBox.Show("登录失败!考试员/操作员编号和密码不匹配,请重试。");
             txtExaminerId.Text   = "";
             txtPassword.Password = "";
         }
         else
         {
             MainWindow mainWindow = new MainWindow();
             mainWindow.Show();
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("登录失败!原因:" + ex.Message + ",位置:" + ex.StackTrace);
         Environment.Exit(0);
     }
     //string strPwd = DateTime.Today.ToString("yyyyMMdd");
     //if (pswBoxLogin.Password.Trim() == strPwd)
     //{
     //	MainWindow mainWindow = new MainWindow();
     //	mainWindow.Show();
     //	this.Close();
     //}
     //else
     //{
     //	MessageBox.Show("密码错误!");
     //	this.pswBoxLogin.Clear();
     //	this.pswBoxLogin.Focus();
     //}
 }
        private void ShowOrders()
        {
            ordersViewer.Children.Clear();
            Orders = DBAccessHelper.GetOrders(CurrentOrder.User.ID);
            if (Orders == null)
            {
                TextBlock tb = new TextBlock()
                {
                    Text = "There are no orders to display!"
                };

                ordersViewer.Children.Add(tb);
                return;
            }
            // iterate orders
            foreach (var order in Orders)
            {
                //order
                string output = "";
                output += $"Order ID: {order.ID}\n";
                output += $"Order Address: {order.Address}\n";
                output += $"Order Date:\n{order.PlacedAt}\n";
                string yesNo = (order.Complete) ? "Yes" : "No";
                output += $"Complete: {yesNo} \n";
                if (order.Complete)
                {
                    output += $"{order.Basket.Count} items ordered";
                }
                else
                {
                    output += $"{order.Basket.Count} items in this basket";
                }

                TextBlock tb = new TextBlock()
                {
                    Text         = output,
                    TextWrapping = TextWrapping.Wrap
                };

                var orderButton = new Button()
                {
                    Content = tb,
                    Tag     = order.ID
                };

                orderButton.Click += OrderButton_Click;

                ordersViewer.Children.Add(orderButton);
            }
        }
예제 #24
0
        ///<summary>
        ///更新学员类型
        ///</summary>
        public bool updStuType(string pidno, int type)
        {
            bool result = true;

            try
            {
                DBAccessHelper.setStudentType(pidno, type);
            }
            catch (Exception ex)
            {
                result = false;
                System.Windows.MessageBox.Show("更新学员类型出错,错误信息:" + ex.Message.ToString());
            }
            return(result);
        }
예제 #25
0
 public void DeleteUserAd(int AdId)
 {
     try
     {
         using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPDELETEUSERAD))
         {
             DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamAdId, DbType.Int32, AdId);
             DBAccessHelper.ExecuteScalar(objDbCommand);
         }
     }
     catch (Exception ex)
     {
         ExceptionLoggin("ManagementDal", "DeleteUserAd", ex.Message);
     }
 }
예제 #26
0
        private void VerifyLoginButton_Click(object sender, RoutedEventArgs e)
        {
            string email    = staffEmailTxt.Text.Trim();
            string password = staffPasswordPwb.Password;
            var    staff    = (StaffModel)DBAccessHelper.GetUser(email, password);

            // invalid staff memeber
            if (staff == null)
            {
                MessageBox.Show("Wrong email/password combination!");
                return;
            }
            // valid staff member
            DialogResult = true;
            Close();
        }
 private void SaveOrderButton_Click(object sender, RoutedEventArgs e)
 {
     if (CurrentOrder.Basket.Count == 0)
     {
         MessageBox.Show("You can't save an empty order!");
         return;
     }
     if (!DBAccessHelper.SaveOrder(CurrentOrder))
     {
         MessageBox.Show("Your order could not be saved!");
     }
     else
     {
         MessageBox.Show("Your order was saved!");
     }
 }
예제 #28
0
        /// <summary>
        /// 写入许可的方法
        /// </summary>
        /// <param name="sPidNo"></param>
        /// <param name="iSeqNo"></param>
        public void WriteTrainLicense(Dictionary <string, string> listSeq)
        {
            List <TrainLicense> m_listTraLic = new List <TrainLicense>();
            string       sJsonTraLic         = "";
            TrainLicense traLic = null;

            foreach (var item in listSeq.Keys)
            {
                dsrsrc.trainMangeDataSet.TraTrainLicenseDataTable.Clear();
                DBAccessHelper.getTrainLicense(int.Parse(listSeq[item]), "", dsrsrc.trainMangeDataSet);
                foreach (DataRow dr in dsrsrc.trainMangeDataSet.TraTrainLicenseDataTable.Rows)
                {
                    traLic = new TrainLicense();
                    traLic.TraBookSeqNo = int.Parse(dr["BookSeqNo"].ToString());
                    traLic.TimeLmt      = Double.Parse(dr["TimeLmt"].ToString());
                    traLic.TriesLmt     = int.Parse(dr["TriesLmt"].ToString());
                    traLic.MileageLmt   = Double.Parse(dr["MileageLmt"].ToString());
                    traLic.AutoId       = dr["AutoId"].ToString().Trim();
                    traLic.AutoType     = dr["AutoType"].ToString();
                    traLic.ChargeMode   = dr["ChargeMode"].ToString();

                    traLic.Date        = dr["Date"].ToString();
                    traLic.Fingerprint = "";              // dr["Fingerprint"].ToString();
                    traLic.Name        = dr["Name"].ToString();
                    traLic.Photo       = "";              // dr["Photo"].ToString();
                    traLic.PidNo       = dr["PidNo"].ToString();

                    traLic.Session     = dr["Session"].ToString();
                    traLic.Trainer     = dr["Trainer"].ToString();
                    traLic.TrainDetail = null;

                    traLic.StudentType      = int.Parse(dr["StudentType"].ToString() == "" ? "0" : dr["StudentType"].ToString());
                    traLic.MinTimeUnit      = int.Parse(dr["MinTimeUnit"].ToString());
                    traLic.ChargingStandard = double.Parse(dr["ChargingStandard"].ToString());
                    traLic.AccountBalance   = double.Parse(dr["AccountBalance"].ToString());

                    m_listTraLic.Add(traLic);
                }
            }
            sJsonTraLic = JsonConvert.SerializeObject(m_listTraLic);
            WriteLicenseWindow writeLicWin = new WriteLicenseWindow(sJsonTraLic, listSeq);

            writeLicWin.ShowDialog();
        }
예제 #29
0
        public int DeleteUserAccount(Int64 BigIntPhoneNumber)
        {
            int Success = 0;

            try
            {
                using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPDELETEUSERACCOUNT))
                {
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamPhoneNumber, DbType.Int64, BigIntPhoneNumber);
                    Success = DBAccessHelper.ExecuteNonQuery(objDbCommand);
                }
                return(Success);
            }
            catch (Exception ex)
            {
                ExceptionLoggin("ManagementDal", "DeleteUserAccount", ex.Message);
                return(0);
            }
        }
예제 #30
0
        public int VerifySelectedAds(string SelectedAds)
        {
            int Success = 0;

            try
            {
                using (DbCommand objDbCommand = DBAccessHelper.GetDBCommand(ConnectionManager.DatabaseToConnect.RaiteRajuDefaultInstance, StoredProcedures.SPVerifyAds))
                {
                    DBAccessHelper.AddInputParametersWithValues(objDbCommand, DataAccessConstants.ParamAdIdS, DbType.String, SelectedAds);
                    Success = DBAccessHelper.ExecuteNonQuery(objDbCommand);
                }
            }
            catch (Exception ex)
            {
                ExceptionLoggin("ManagementDal", "VerifySelectedAds", ex.Message);
                Success = 0;
            }
            return(Success);
        }