public CustomerOrderHistoryList()
        {
            try
            {
                CustomerOrderViewModel customerOrderViewModel = new CustomerOrderViewModel();
                InitializeComponent();
                CenterWindowOnScreen();

                dpFromDate.SelectedDate   = System.DateTime.Now;
                dpToDate.SelectedDate     = System.DateTime.Now;
                customerOrderHistoryModel = customerOrderViewModel.GetCustomerOrderHistoryList(dpFromDate.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDate.SelectedDate.Value.ToString(CommonMethods.DateFormat));

                if (customerOrderHistoryModel.Count > 0)
                {
                    lblInvoiceCount.Content = customerOrderHistoryModel[0].InvoiceCount;
                    lblInvoiceTotal.Content = customerOrderHistoryModel[0].InvoiceTotal;
                }
                else
                {
                    lblInvoiceCount.Content = "0";
                    lblInvoiceTotal.Content = "0.00";
                }
                this.dgOrderList.ItemsSource = customerOrderHistoryModel;
            }
            catch (Exception ex)
            {
                SystemError.Register(ex);
            }
        }
 private void btnChangePaymentMethod_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var order = (CustomerOrderHistoryModel)dgOrderList.SelectedItem;
         if (string.IsNullOrEmpty(order.Payment) || order.Payment.Contains(","))
         {
             var messageBoxResult = WpfMessageBox.Show(StatusMessages.CustomerOrderHistory, StatusMessages.PaymentMethodModifyNotAllow, MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning);
             cmbSelectPaymentMethod.Focus();
             return;
         }
         ppChangePaymentMethod.IsOpen = true;
         CustomerOrderViewModel    customerOrderViewModel = new CustomerOrderViewModel();
         List <PaymentMethodModel> paymentMethodModels    = new List <PaymentMethodModel>();
         paymentMethodModels = customerOrderViewModel.GetPaymentMethod();
         cmbSelectPaymentMethod.ItemsSource       = paymentMethodModels;
         cmbSelectPaymentMethod.Text              = "Select Payment";
         cmbSelectPaymentMethod.IsEditable        = true;
         cmbSelectPaymentMethod.IsReadOnly        = true;
         cmbSelectPaymentMethod.SelectedValuePath = "Id";
         cmbSelectPaymentMethod.DisplayMemberPath = "PaymentMethodName";
     }
     catch (Exception ex)
     {
         SystemError.Register(ex);
     }
 }
예제 #3
0
 public bool Open()
 {
     ReadXml();
     conn = new SqlConnection();
     //conn.ConnectionString = "server=SQLOLEDB.1;Persist Security Info=True;User ID=" + username + ";pwd=" + password + ";Initial Catalog=" + catalog + ";Data Source=" + server;
     conn.ConnectionString = @"server=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial Catalog=YY_DB;Data Source=.";
     conn.Open();
     DataBase_State = "数据库打开成功![" + DateTime.Now.ToString() + "]\r\n";
     if (conn.State == ConnectionState.Closed)
     {
         try
         {
             conn.Open();
             DataBase_State = "数据库打开成功![" + DateTime.Now.ToString() + "]\r\n";
             return(true);
         }
         catch (Exception ex)
         {
             SystemError.SystemLog(ex.Message);
             DataBase_State = "数据库打开失败![" + DateTime.Now.ToString() + "]\r\n";
             return(false);
         }
     }
     return(true);
 }
예제 #4
0
        public DataTable Select(string TableName, string[] Fields, string Where)
        {
            DataTable     dt       = new DataTable();
            StringBuilder sb_Sql   = new StringBuilder();
            StringBuilder sb_field = new StringBuilder();

            for (int i = 0; i < Fields.Length; i++)
            {
                sb_field.Append(Fields[i]);
                sb_field.Append(",");
            }
            sb_field.Remove(sb_field.Length - 1, 1);
            sb_Sql.Append("select ");
            sb_Sql.Append(sb_field.ToString());
            sb_Sql.Append(" from ");
            sb_Sql.Append(TableName);
            sb_Sql.Append(" ");
            sb_Sql.Append(Where);

            try
            {
                using (SqlDataAdapter da = new SqlDataAdapter(sb_Sql.ToString(), conn))
                {
                    da.Fill(dt);
                    da.Dispose();
                }
            }
            catch (Exception ex)
            {
                SystemError.SystemLog(ex.Message);
                dt = null;
            }

            return(dt);
        }
        private void btnSearchOrderList_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                List <CustomerOrderHistoryModel> customerOrderHistoryModel = new List <CustomerOrderHistoryModel>();
                CustomerOrderViewModel           customerOrderViewModel    = new CustomerOrderViewModel();
                customerOrderHistoryModel    = customerOrderViewModel.GetCustomerOrderHistoryList(dpFromDate.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDate.SelectedDate.Value.ToString(CommonMethods.DateFormat));
                this.dgOrderList.ItemsSource = customerOrderHistoryModel;

                if (customerOrderHistoryModel.Count > 0)
                {
                    lblInvoiceCount.Content = customerOrderHistoryModel[0].InvoiceCount;
                    lblInvoiceTotal.Content = customerOrderHistoryModel[0].InvoiceTotal;
                }
                else
                {
                    lblInvoiceCount.Content = "0";
                    lblInvoiceTotal.Content = "0.00";
                }
            }
            catch (Exception ex)
            {
                SystemError.Register(ex);
            }
        }
예제 #6
0
        /// <summary>
        /// 增、删、改操作数据库的方法(存储过程)
        /// </summary>
        /// <param name="ProcedureName">存储过程名</param>
        /// <param name="VariableName">参数集合</param>
        /// <param name="Values">值集合</param>
        /// <returns>返回操作状态(true成功,false失败)</returns>
        public bool ExecProcedure(string ProcedureName, string[] VariableName, object[] Values)
        {
            bool Bool = true;

            try
            {
                MySqlCommand cmd = new MySqlCommand(ProcedureName, conn);
                for (int i = 0; i < VariableName.Length; i++)
                {
                    cmd.Parameters.Add("?" + VariableName[i], Values[i]);
                }

                cmd.CommandType = CommandType.StoredProcedure;

                Open();
                cmd.ExecuteNonQuery();
                cmd.Parameters.Clear();
                Close();
            }
            catch (Exception ex)
            {
                SystemError.SystemLog(ex.Message);
                Bool = false;
            }
            return(Bool);
        }
예제 #7
0
        //private void AddMockedData()
        //{
        //    var ctx = this.DataContext as ErrorLogViewModel;

        //    ctx.LogError(ErrorType.Error, ErrorCategory.PipingErrors, new List<string>{
        //        "Sample 1 piping error",
        //    });

        //    ctx.LogError(ErrorType.Message, ErrorCategory.PipingErrors, new List<string>{
        //        "Sample 2 piping message adfasd asd fasd fasdf asdfas",
        //    });

        //    ctx.LogError(ErrorType.Warning, ErrorCategory.PipingErrors, new List<string>{
        //        "Sample 3 piping warning",
        //    });
        //}

        /// <summary>
        /// Logs system errors
        /// </summary>
        /// <param name="Err">Error Type</param>
        /// <param name="ErrCat">Category</param>
        /// <param name="ErrMsg">Message</param>
        public static void LogError(ErrorType Err, ErrorCategory ErrCat, string ErrMsg)
        {
            if (string.IsNullOrEmpty(ErrMsg))
            {
                return;
            }

            var evm = new ErrorLogViewModel();

            if (!(evm.GetPipingError.Any(x => x.Description == ErrMsg)))
            {
                var imgpath = string.Empty;
                if (ErrorType.Error == Err)
                {
                    imgpath = "..\\..\\Image\\TypeImages\\Error.png";
                }
                else
                {
                    imgpath = "..\\..\\Image\\TypeImages\\Warning.png";
                }

                var err = new SystemError()
                {
                    Type        = Err,
                    Category    = ErrCat,
                    Description = ErrMsg
                };

                evm.GetPipingError.Add(err);
            }
            else
            {
                return;
            }
        }
예제 #8
0
        public SqlDataReader GetSingleUser(int nUserID)
        {
            ///定义类SQLHelper
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();

            ///定义保存从数据库获取的结果的DataReader
            SqlDataReader dr = null;

            ///创建访问数据库的参数
            SqlParameter[] paramList =
            {
                sqlHelper.CreateInParam("@UserID", SqlDbType.Int, 4, nUserID)
            };

            try
            {
                ///执行存储过程
                sqlHelper.RunProc("Pr_GetSingleUser", paramList, out dr);
            }
            catch (Exception ex)
            {
                ///抛出执行数据库异常
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }

            ///返回从数据库获取的结果
            return(dr);
        }
예제 #9
0
        public SqlDataReader GetUserLogin(string sUserName, string sPassword)
        {
            ///定义类SQLHelper
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();

            ///定义保存从数据库获取的结果的DataReader
            SqlDataReader dr = null;

            ///创建访问数据库的参数
            SqlParameter[] paramList =
            {
                sqlHelper.CreateInParam("@UserName", SqlDbType.VarChar, 200, sUserName),
                sqlHelper.CreateInParam("@Password", SqlDbType.VarChar, 255, sPassword)
            };

            try
            {
                ///执行存储过程
                sqlHelper.RunProc("Pr_GetUserLogin", paramList, out dr);
            }
            catch (Exception ex)
            {
                ///抛出执行数据库异常
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }

            ///返回从数据库获取的结果
            return(dr);
        }
예제 #10
0
        public static void UploadError(string msg, string innserMsg)
        {
            SQLDomainDataProvider provider = BenQGuru.eMES.Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider() as SQLDomainDataProvider;
            SystemSettingFacade   facade   = new SystemSettingFacade(provider);

            SystemError systemError = facade.CreateNewSystemError();

            systemError.SystemErrorCode   = Guid.NewGuid().ToString();
            systemError.ErrorMessage      = FormatHelper.CleanString(msg, 100);
            systemError.InnerErrorMessage = FormatHelper.CleanString(innserMsg, 100);
            systemError.TriggerModuleCode = SessionHelper.Current(HttpContext.Current.Session).ModuleCode;
            systemError.SendUser          = SessionHelper.Current(HttpContext.Current.Session).UserCode;
            if (systemError.SendUser == null || systemError.SendUser == string.Empty)
            {
                systemError.SendUser = "******";
            }
            systemError.SendDate     = FormatHelper.TODateInt(DateTime.Now);
            systemError.SendTime     = FormatHelper.TOTimeInt(DateTime.Now);
            systemError.IsResolved   = FormatHelper.BooleanToString(false);
            systemError.MaintainUser = SessionHelper.Current(HttpContext.Current.Session).UserCode;
            if (systemError.MaintainUser == null || systemError.MaintainUser == string.Empty)
            {
                systemError.MaintainUser = "******";
            }

            facade.AddSystemError(systemError);
            provider.PersistBroker.CloseConnection();
        }
예제 #11
0
        /// <summary>
        /// 用户是否存在
        /// </summary>
        /// <param name="sUserName"></param>
        /// <returns></returns>
        public bool Login_Admin(string sUserName)
        {
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();
            SqlParameter[]      ParamList = { sqlHelper.CreateInParam("@UserName", SqlDbType.NVarChar, 50, sUserName) };
            SqlDataReader       rec       = null;

            try
            {
                sqlHelper.RunProc("Login_Admin", ParamList, out rec);
            }
            catch (Exception ex)
            {
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }
            bool Bool = false;

            while (rec.Read())
            {
                if (sUserName == rec["UserName"].ToString())
                {
                    Bool = true;
                }
            }
            return(Bool);
        }
예제 #12
0
        /// <summary>
        /// 查看分类
        /// </summary>
        /// <param name="nParentID"></param>
        /// <returns></returns>
        public List <ProductClass> Get_ProductClass(int nParentID)
        {
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();
            SqlParameter[]      ParamList =
            {
                sqlHelper.CreateInParam("@ParentID", SqlDbType.Int, 4, nParentID)
            };
            SqlDataReader rec = null;

            try
            {
                sqlHelper.RunProc("Get_ProductClass", ParamList, out rec);
            }
            catch (Exception ex)
            {
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }
            List <ProductClass> List_ProductClass = new List <ProductClass>();

            while (rec.Read())
            {
                Model.ProductClass productClass = new ProductClass();
                productClass.ClassID     = Int32.Parse(rec["ClassID"].ToString());
                productClass.ClassName   = rec["ClassName"].ToString();
                productClass.ParentID    = Int32.Parse(rec["ParentID"].ToString());
                productClass.ParentOrder = Int32.Parse(rec["ParentOrder"].ToString());
                List_ProductClass.Add(productClass);
                productClass = null;
            }
            return(List_ProductClass);
        }
예제 #13
0
        public bool Insert(string TableName, string[] Fields, object[] Values)
        {
            bool          Bool     = true;
            StringBuilder sb_Str   = new StringBuilder();
            StringBuilder sb_Field = new StringBuilder();
            StringBuilder sb_Sql   = new StringBuilder();

            try
            {
                for (int i = 0; i < Fields.Length; i++)
                {
                    sb_Field.Append(Fields[i]);
                    sb_Field.Append(",");

                    sb_Str.Append("@");
                    sb_Str.Append(Fields[i]);
                    sb_Str.Append(",");
                }
                sb_Field.Remove(sb_Field.Length - 1, 1);
                sb_Str.Remove(sb_Str.Length - 1, 1);

                sb_Sql.Append("insert into ");
                sb_Sql.Append(TableName);
                sb_Sql.Append("(");
                sb_Sql.Append(sb_Field);
                sb_Sql.Append(") values(");
                sb_Sql.Append(sb_Str);
                sb_Sql.Append(")");


                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    using (SqlCommand cmd = new SqlCommand(sb_Sql.ToString(), connection))
                    {
                        for (int i = 0; i < Fields.Length; i++)
                        {
                            cmd.Parameters.Add("@" + Fields[i], Values[i]);
                        }

                        try
                        {
                            connection.Open();
                            cmd.ExecuteNonQuery();
                            connection.Close();
                        }
                        catch (System.Data.SqlClient.SqlException e)
                        {
                            connection.Close();
                            throw e;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SystemError.SystemLog(ex.Message);
                Bool = false;
            }
            return(Bool);
        }
예제 #14
0
        public static void PutToErrorQueue(SystemError error)
        {
            string            xmlString = error.SerializeToXml();
            CloudQueueMessage message   = new CloudQueueMessage(xmlString);

            CurrErrorQueue.AddMessage(message);
        }
예제 #15
0
        /// <summary>
        /// 查看单个
        /// </summary>
        /// <param name="nID"></param>
        /// <returns></returns>
        public Job Get_SingJob(int nID)
        {
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();
            SqlParameter[]      ParamList = { sqlHelper.CreateInParam("@ID", SqlDbType.Int, 4, nID) };
            SqlDataReader       rec       = null;

            try
            {
                sqlHelper.RunProc("Get_SingJob", ParamList, out rec);
            }
            catch (Exception ex)
            {
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }
            Job job = new Job();

            while (rec.Read())
            {
                job.ID         = Int32.Parse(rec["ID"].ToString());
                job.Title      = rec["Title"].ToString();
                job.Content    = rec["Content"].ToString();
                job.Updatatime = DateTime.Parse(rec["Updatatime"].ToString());
                job.Click      = Int32.Parse(rec["Click"].ToString());
            }
            return(job);
        }
예제 #16
0
        protected void cmdUploadError_ServerClick(object sender, System.EventArgs e)
        {
            SystemSettingFacade facade = new SystemSettingFacade(base.DataProvider);

            SystemError systemError = facade.CreateNewSystemError();

            systemError.SystemErrorCode   = Guid.NewGuid().ToString();
            systemError.ErrorMessage      = FormatHelper.CleanString(this.GetRequestParam("msg"), 100);
            systemError.InnerErrorMessage = FormatHelper.CleanString(this.GetRequestParam("innermsg"), 100);
            systemError.TriggerModuleCode = SessionHelper.Current(this.Session).ModuleCode;
            systemError.SendUser          = this.GetUserCode();
            if (systemError.SendUser == null || systemError.SendUser == string.Empty)
            {
                systemError.SendUser = "******";
            }
            systemError.SendDate     = FormatHelper.TODateInt(DateTime.Now);
            systemError.SendTime     = FormatHelper.TOTimeInt(DateTime.Now);
            systemError.IsResolved   = FormatHelper.BooleanToString(false);
            systemError.MaintainUser = this.GetUserCode();
            if (systemError.MaintainUser == null || systemError.MaintainUser == string.Empty)
            {
                systemError.MaintainUser = "******";
            }

            facade.AddSystemError(systemError);

            string scriptString = "<script language=JavaScript>window.name+='[back]';window.parent.history.back(-1);</script>";

            if (!this.IsClientScriptBlockRegistered("clientScript"))
            {
                this.RegisterClientScriptBlock("clientScript", scriptString);
            }
        }
예제 #17
0
        public int AddUser(string sUserName, string sPassword, string sEmail, int nRoleID)
        {
            ///定义类SQLHelper
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();

            ///创建访问数据库的参数
            SqlParameter[] paramList =
            {
                sqlHelper.CreateInParam("@UserName", SqlDbType.VarChar, 200, sUserName),
                sqlHelper.CreateInParam("@Password", SqlDbType.VarChar, 255, sPassword),
                sqlHelper.CreateInParam("@Email",    SqlDbType.VarChar, 200, sEmail),
                sqlHelper.CreateInParam("@RoleID",   SqlDbType.Int,       4, nRoleID)
            };

            try
            {
                ///执行存储过程
                return(sqlHelper.RunProc("Pr_AddUser", paramList));
            }
            catch (Exception ex)
            {
                ///抛出执行数据库异常
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }
        }
예제 #18
0
        /// <summary>
        /// 查询操作数据库的方法(存储过程)
        /// </summary>
        /// <param name="ProcedureName">存储过程名</param>
        /// <param name="VariableName">参数集合</param>
        /// <param name="Values">值集合</param>
        /// <returns>返回DataTable的集合</returns>
        public DataTable ExecProcedureSelect(string ProcedureName, string[] VariableName, object[] Values)
        {
            DataTable dt = new DataTable();

            try
            {
                using (SqlDataAdapter da = new SqlDataAdapter())
                {
                    SqlCommand cmd = new SqlCommand(ProcedureName, conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    for (int i = 0; i < VariableName.Length; i++)
                    {
                        cmd.Parameters.AddWithValue("@" + VariableName[i], Values[i]);
                    }
                    da.SelectCommand = cmd;
                    da.Fill(dt);
                    da.Dispose();
                }
            }
            catch (Exception ex)
            {
                SystemError.SystemLog(ex.Message);
                dt = null;
            }
            return(dt);
        }
예제 #19
0
        private static void SaveLog(string issuedBy, SeverityEnum severity, SystemError sys, string issuedMessage)
        {
            if (issuedMessage.Length >= 4000)
            {
                issuedMessage = issuedMessage.Substring(0, 4000);
            }

            var options = new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            };

            using (var exceptionLogScope = new TransactionScope(TransactionScopeOption.RequiresNew, options))
            {
                using (var container = new TransactionModelContainer())
                {
                    container.ErrorLogs.AddObject(new ErrorLog
                    {
                        IssuedBy        = issuedBy,
                        IssuedDate      = DateTime.Now,
                        IssuedMessage   = issuedMessage,
                        Severity        = (byte)severity,
                        SystemErrorId   = (byte)sys,
                        SystemErrorName = sys.ToString(),
                    });

                    container.SaveChanges();
                    exceptionLogScope.Complete();
                }
            }
        }
예제 #20
0
        /// <summary>
        /// 查看全部
        /// </summary>
        /// <returns></returns>
        public List <Admin> Get_Admin()
        {
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();
            SqlDataReader       rec       = null;

            try
            {
                sqlHelper.RunProc("Get_Admin", out rec);
            }
            catch (Exception ex)
            {
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }
            List <Admin> List_Admin = new List <Admin>();

            while (rec.Read())
            {
                Admin admin = new Admin();
                admin.ID            = Int32.Parse(rec["ID"].ToString());
                admin.UserName      = rec["UserName"].ToString();
                admin.Password      = rec["Password"].ToString();
                admin.LastLoginIP   = rec["LastLoginIP"].ToString();
                admin.LastLoginTime = DateTime.Parse(rec["LastLoginTime"].ToString());
                List_Admin.Add(admin);
                admin = null;
            }
            return(List_Admin);
        }
예제 #21
0
        /// <summary>
        /// 查看单个
        /// </summary>
        /// <param name="nID"></param>
        /// <returns></returns>
        public Admin Get_SingAdmin(string sUserName)
        {
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();
            SqlParameter[]      ParamList = { sqlHelper.CreateInParam("@UserName", SqlDbType.NVarChar, 50, sUserName) };
            SqlDataReader       rec       = null;

            try
            {
                sqlHelper.RunProc("Get_SingAdmin", ParamList, out rec);
            }
            catch (Exception ex)
            {
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }
            Admin admin = new Admin();

            while (rec.Read())
            {
                admin.ID            = Int32.Parse(rec["ID"].ToString());
                admin.UserName      = rec["UserName"].ToString();
                admin.Password      = rec["Password"].ToString();
                admin.LastLoginIP   = rec["LastLoginIP"].ToString();
                admin.LastLoginTime = DateTime.Parse(rec["LastLoginTime"].ToString());
            }
            return(admin);
        }
예제 #22
0
            public static IList <T> Select(string TableName, string[] Fields, string Where)
            {
                DataTable     dt       = new DataTable();
                StringBuilder sb_Sql   = new StringBuilder();
                StringBuilder sb_field = new StringBuilder();

                for (int i = 0; i < Fields.Length; i++)
                {
                    sb_field.Append(Fields[i]);
                    sb_field.Append(",");
                }
                sb_field.Remove(sb_field.Length - 1, 1);
                sb_Sql.Append("select ");
                sb_Sql.Append(sb_field.ToString());
                sb_Sql.Append(" from ");
                sb_Sql.Append(TableName);
                sb_Sql.Append(" ");
                sb_Sql.Append(Where);

                try
                {
                    MySqlDataAdapter da = new MySqlDataAdapter(sb_Sql.ToString(), new MySqlConnection()); //MySqlData.conn
                    da.Fill(dt);
                    da.Dispose();
                }
                catch (Exception ex)
                {
                    SystemError.SystemLog(ex.Message);
                    dt = null;
                }
                return(ModelConvertHelper <T> .ConvertToModel(dt));
            }
예제 #23
0
        private void ChangeKOTAllItemStatus(object sender, RoutedEventArgs e)
        {
            try
            {
                KitchenViewModel kitchenViewModel = new KitchenViewModel();
                var    btnChangeStatus            = sender as Button;
                string kotId = btnChangeStatus.Name.Substring(4);

                if (btnChangeStatus.Content.ToString() == "C")
                {
                    kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Cooking);
                }
                else if (btnChangeStatus.Content.ToString() == "P")
                {
                    kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Pending);
                }
                else if (btnChangeStatus.Content.ToString() == "D")
                {
                    kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Completed);
                }
                GetKitchenPending(KitchenOrder);
            }
            catch (Exception ex)
            {
                SystemError.Register(ex);
            }
        }
예제 #24
0
        public bool Delete_W(object obj, string Where)
        {
            string TableName;

            Type t = obj.GetType();

            TableName = t.Name;

            bool Bool = true;

            try
            {
                MySqlCommand cmd = new MySqlCommand("delete from " + TableName + " " + Where, conn);
                Open();
                cmd.ExecuteNonQuery();
                Close();
            }
            catch (Exception ex)
            {
                SystemError.SystemLog(ex.Message);
                Bool = false;
                Close();
            }
            return(Bool);
        }
        protected override void ExcuteSelf()
        {
            IContract iContract = new ContractDal();
            GetEmployee getEmployee = new GetEmployee();
            List<Employee> employeeList = new List<Employee>();
            employeeList.AddRange(
                getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.NormalEmployee, -1,
                                                                 _DepartmentID,
                                                                 true,-1));
            employeeList.AddRange(
                getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.ProbationEmployee, -1,
                                                                 _DepartmentID,
                                                                 true,-1));
            employeeList.AddRange(
                getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.BorrowedEmployee, -1,
                                                                 _DepartmentID,
                                                                 true,-1));
            employeeList.AddRange(
                getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.PartTimeEmployee, -1,
                                                                 _DepartmentID,
                                                                 true,-1));
            employeeList.AddRange(
                getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.PracticeEmployee, -1,
                                                                 _DepartmentID,
                                                                 true,-1));
            employeeList.AddRange(
                getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.Retirement, -1,
                                                                 _DepartmentID,
                                                                 true,-1));
            employeeList.AddRange(
                getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.RetirementHire, -1,
                                                                 _DepartmentID,
                                                                 true,-1));
            employeeList.AddRange(
                getEmployee.GetEmployeeBasicInfoByBasicCondition(_EmployeeName, EmployeeTypeEnum.WorkEmployee, -1,
                                                                 _DepartmentID,
                                                                 true,-1));
            employeeList = HrmisUtility.RemoteUnAuthEmployee(employeeList, AuthType.HRMIS, _Account, _Powers);
            foreach (Employee employee in employeeList)
            {

                string description = string.Empty;
                Contract contract = iContract.GetLastContractInAllTypeByAccountID(employee.Account.Id, _CurrentDate);
                if (contract == null)
                {
                    description = string.Format("{0}目前没有合同信息", employee.Account.Name);
                }
                if (string.IsNullOrEmpty(description))
                {
                    continue;
                }
                SystemError error = new SystemError(description, ErrorType.EmployeeContractError, employee.Account.Id);
                error.ErrorEmployee = employee;
                error.EditUrl =
                    string.Format("{0}employeeID={1}",
                                  ErrorType.EmployeeContractError.EditPageUrl,
                                  SecurityUtil.DECEncrypt(employee.Account.Id.ToString()));
                _SystemErrorList.Add(error);
            }
        }
예제 #26
0
        /// <summary>
        /// 按分类查看总数
        /// </summary>
        /// <param name="nClassID"></param>
        /// <returns></returns>
        public int Get_NewsNum(int nClassID)
        {
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();
            SqlParameter[]      ParamList =
            {
                sqlHelper.CreateInParam("@startIndex", SqlDbType.Int, 4,        1),
                sqlHelper.CreateInParam("@endIndex",   SqlDbType.Int, 4,        1),
                sqlHelper.CreateInParam("@Classid",    SqlDbType.Int, 4, nClassID),
                sqlHelper.CreateInParam("@docount",    SqlDbType.Bit, 1, 1)
            };
            SqlDataReader rec = null;

            try
            {
                sqlHelper.RunProc("Get_ClassNews", ParamList, out rec);
            }
            catch (Exception ex)
            {
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }
            int Num = 0;

            while (rec.Read())
            {
                Num = Int32.Parse(rec["Counts"].ToString());
            }
            return(Num);
        }
예제 #27
0
        /// <summary>
        /// 查看全部
        /// </summary>
        /// <param name="nstartIndex"></param>
        /// <param name="endIndex"></param>
        /// <returns></returns>
        public List <Job> Get_Job(int nstartIndex, int nendIndex)
        {
            SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();
            SqlParameter[]      ParamList =
            {
                sqlHelper.CreateInParam("@startIndex", SqlDbType.Int, 4, nstartIndex),
                sqlHelper.CreateInParam("@endIndex",   SqlDbType.Int, 4, nendIndex),
                sqlHelper.CreateInParam("@docount",    SqlDbType.Bit, 1, 0)
            };
            SqlDataReader rec = null;

            try
            {
                sqlHelper.RunProc("Get_Job", ParamList, out rec);
            }
            catch (Exception ex)
            {
                SystemError.CreateErrorLog(ex.Message);
                throw new Exception(ex.Message, ex);
            }
            List <Job> List_Job = new List <Job>();

            while (rec.Read())
            {
                Job job = new Job();
                job.ID         = Int32.Parse(rec["ID"].ToString());
                job.Title      = rec["Title"].ToString();
                job.Content    = rec["Content"].ToString();
                job.Updatatime = DateTime.Parse(rec["Updatatime"].ToString());
                job.Click      = Int32.Parse(rec["Click"].ToString());
                List_Job.Add(job);
                job = null;
            }
            return(List_Job);
        }
예제 #28
0
        /// <summary>
        /// 删除操作数据库的方法
        /// </summary>
        /// <param name="sqlDel">删除操作的SQL语句</param>
        /// <returns>返回操作状态(true成功,false失败)</returns>
        public bool Delete(string sqlDel)
        {
            bool Bool = true;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                using (SqlCommand cmd = new SqlCommand(sqlDel, connection))
                {
                    try
                    {
                        //Open();
                        connection.Open();
                        cmd.ExecuteNonQuery();
                        connection.Close();
                        //Close();
                    }
                    catch (Exception ex)
                    {
                        connection.Close();
                        SystemError.SystemLog(ex.Message);
                        Bool = false;
                    }
                }
            }

            return(Bool);
        }
예제 #29
0
        public static void ReportEnvelopeWithException(QueueEnvelope envelope, Exception exception)
        {
            SystemError error = GetErrorFromExcetion(exception);

            error.MessageContent = envelope;
            ReportError(error);
        }
예제 #30
0
        /// <summary>
        /// 得到自增列的信息
        /// </summary>
        /// <param name="TableName">表名</param>
        /// <returns></returns>
        public DataTable GetIncrementColumn(string TableName)
        {
            DataTable dt = new DataTable();

            StringBuilder sb = new StringBuilder();

            sb.Append("select so.name Table_name,sc.name Column_name,");
            sb.Append("ident_current(so.name) curr_value,");
            sb.Append("ident_incr(so.name)incr_value,");   //增量
            sb.Append("ident_seed(so.name) seed_value ");  //种子
            sb.Append("from sysobjects so inner join syscolumns sc ");
            sb.Append("on so.id=sc.id and columnproperty(sc.id,sc.name,'IsIdentity')=1 where upper(so.name)=upper('" + TableName + "')");
            try
            {
                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    using (SqlDataAdapter da = new SqlDataAdapter(sb.ToString(), connection))
                    {
                        da.Fill(dt);
                        da.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                SystemError.SystemLog(ex.Message);
                dt = null;
            }

            return(dt);
        }
        public void Save()
        {
            ISystemErrorRepository iSystemErrorRepository = new SystemErrorRepository(this.connectionString);

            SystemError systemError = new SystemError
                (
                    new AppActs.DomainModel.Exception.DeviceException("message", "stackTrace", "source", "data"),
                    new AppActs.DomainModel.System(AppActs.DomainModel.Enum.PlatformType.iOS, "1.1"),
                    DateTime.Now,
                    "6.5"
                );

            iSystemErrorRepository.Save(this.Application.Id, this.Device.Id, systemError);
        }
예제 #32
0
 public static SystemError GetErrorFromExcetion(Exception exception)
 {
     SystemError error = new SystemError
                             {
                                 ErrorTitle = "Exception: " + exception.GetType().Name,
                                 OccurredAt = DateTime.UtcNow,
                                 SystemErrorItems = new SystemErrorItemCollection()
                             };
     error.SystemErrorItems.CollectionContent.Add(new SystemErrorItem()
                                                      {
                                                          ShortDescription = exception.Message,
                                                          LongDescription = exception.ToString()
                                                      });
     return error;
 }
예제 #33
0
 private static SystemError GetErrorFromMessage(CloudQueueMessage message)
 {
     SystemError error = new SystemError
                             {
                                 ErrorTitle = "Cloud Message: " + message.Id,
                                 OccurredAt = DateTime.UtcNow,
                                 SystemErrorItems = new SystemErrorItemCollection()
                             };
     error.SystemErrorItems.CollectionContent.Add(new SystemErrorItem()
                                                      {
                                                          ShortDescription = "Message content",
                                                          LongDescription = message.AsString
                                                      });
     return error;
 }
예제 #34
0
파일: RspError.cs 프로젝트: yorkart/NDWR
 public RspError(SystemError error)
 {
     switch (error) {
         case SystemError.NoPermission: {
                 this.Name = error.ToString();
                 this.Message = "没有权限";
             }
             break;
         case SystemError.RunTimeError: {
                 this.Name = error.ToString();
                 this.Message = "运行环境出错";
             }
             break;
         case SystemError.SessionTimeout: {
                 this.Name = error.ToString();
                 this.Message = "会话过期";
             }
             break;
         case SystemError.ServiceException: {
                 this.Name = error.ToString();
                 this.Message = "服务端方法异常";
             }
             break;
         case SystemError.NoMatchService: {
                 this.Name = error.ToString();
                 this.Message = "没有匹配到相应的服务";
             }
             break;
         case SystemError.NoMatchParam: {
                 this.Name = error.ToString();
                 this.Message = "没有匹配到参数";
             }
             break;
         case SystemError.ParamIndex: {
                 this.Name = error.ToString();
                 this.Message = "参数索引顺序错误";
             }
             break;
         default: {
                 this.Name = SystemError.UnKnown.ToString();
                 this.Message = "未知错误";
             }
             break;
     }
 }
예제 #35
0
 public static void ReportError(SystemError error)
 {
     QueueSupport.PutToErrorQueue(error);
 }
		public override void OnError(SystemError arg0)
		{
			UnityEngine.Debug.Log(string.Format("An error occured! {0} (#{1})", arg0.Error, arg0.ErrorCode));
		}
예제 #37
0
        private static void SaveLog(string issuedBy, SeverityEnum severity, SystemError sys, string issuedMessage)
        {
            if (issuedMessage.Length >= 4000)
            {
                issuedMessage = issuedMessage.Substring(0, 4000);
            }

            var options = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted };
            using (var exceptionLogScope = new TransactionScope(TransactionScopeOption.RequiresNew, options))
            {
                using (var container = new TransactionModelContainer())
                {
                    container.ErrorLogs.AddObject(new ErrorLog
                            {
                                IssuedBy = issuedBy,
                                IssuedDate = DateTime.Now,
                                IssuedMessage = issuedMessage,
                                Severity = (byte)severity,
                                SystemErrorId = (byte)sys,
                                SystemErrorName = sys.ToString(),
                            });

                    container.SaveChanges();
                    exceptionLogScope.Complete();
                }
            }
        }
예제 #38
0
 public static void Log(string issuedBy, Exception ex, SystemError sys, SeverityEnum severity = SeverityEnum.HIGH)
 {
     SaveLog(issuedBy, severity, sys, GetStackTraceMessage(ex));
 }
예제 #39
0
 public static void Log(string issuedBy, string issuedMessage, SystemError sys, SeverityEnum severity = SeverityEnum.HIGH)
 {
     SaveLog(issuedBy, severity, sys, issuedMessage);
 }
예제 #40
0
파일: RspError.cs 프로젝트: yorkart/NDWR
 public RspError(SystemError error, string message)
 {
     this.Name = error.ToString();
     this.Message = message;
 }
예제 #41
0
 public static void PutToErrorQueue(SystemError error)
 {
     string xmlString = error.SerializeToXml();
     CloudQueueMessage message = new CloudQueueMessage(xmlString);
     CurrErrorQueue.AddMessage(message);
 }