示例#1
0
        public List <Model.User> GetAllUsers(string limit, string skip)
        {
            MySqlCommand    command = null;
            MySqlDataReader reader  = null;

            try
            {
                string query = string.Format("SELECT {0}.*, {1}.company_id as company_id, {2}.role_id as role_id FROM {0} " +
                                             "INNER JOIN {1} ON {1}.user_id={0}.id " +
                                             "INNER JOIN {2} ON {2}.user_id={0}.id " +
                                             "WHERE deleted=0 ORDER BY creation_date DESC ",
                                             TABLE_USERS, TABLE_USER_COMPANY, TABLE_USER_ROLE);

                if (limit != null)
                {
                    query += string.Format("LIMIT {0} ", limit);
                }

                if (skip != null)
                {
                    query += string.Format("OFFSET {0} ", skip);
                }

                command = new MySqlCommand(query);
                reader  = PerformSqlQuery(command);

                List <Model.User> userList = new List <Model.User>();
                while (reader.Read())
                {
                    userList.Add(generateUserObj(reader));
                }

                return(userList);
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Error, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, command);
            }

            return(null);
        }
示例#2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            CrisisCode cc = new CrisisCode();

            cc.Code = txtAddCrisisCode.Text;
            cc.Name = txtAddCrisisName.Text;
            db.CrisisCodes.InsertOnSubmit(cc);

            db.SubmitChanges();
            this.gvCrisisCodes.DataBind();

            //audit trail
            DBLogger.Log("Create", "Created Crisis Code", cc.Name);

            //hide modal
            Javascript.HideModal(this, this, "addModal");
        }
示例#3
0
        public Model.JobDelivery Get(string jobId)
        {
            MySqlCommand    mySqlCmd = null;
            MySqlDataReader reader   = null;

            try
            {
                string query = string.Format("SELECT {0}.*, {1}.id as Jid, {1}.job_status_id as JSid, {2}.delivery_date FROM (SELECT * FROM {2} ORDER BY {2}.delivery_date ASC) AS {2} " +
                                             "INNER JOIN {0} ON {0}.job_id={2}.id " +
                                             "LEFT JOIN {1} ON {0}.job_id={1}.job_id " +
                                             "WHERE {0}.job_id=@job_id AND {2}.deleted=0 AND {2}.enabled=1 ",
                                             TABLE_NAME, TABLE_ORDER_STATUS, TABLE_JOBS);

                mySqlCmd = new MySqlCommand(query);
                mySqlCmd.Parameters.AddWithValue("job_id", jobId);

                reader = PerformSqlQuery(mySqlCmd);

                Model.JobDelivery result = null;
                while (reader.Read())
                {
                    if (result == null)
                    {
                        result = constructObj(reader);
                    }
                    else
                    {
                        result.orderStatusList.Insert(0, constructJobOrder(reader));
                    }
                }

                return(result);
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, mySqlCmd);
            }

            return(null);
        }
示例#4
0
        public List <Vouchers> Get(string limit, string skip)
        {
            MySqlCommand    mySqlCmd = null;
            MySqlDataReader reader   = null;

            try
            {
                string query = string.Format("SELECT {0}.*,{1}.id as vid,{1}.name as vname FROM {0} " +
                                             "INNER JOIN {1} ON {0}.voucher_type_id ={1}.id " +
                                             "ORDER BY creation_date ASC ",
                                             TABLE_VOUCHER, TABLE_VOUCHER_TYPE);

                if (limit != null)
                {
                    query += string.Format("LIMIT {0} ", limit);
                }

                if (skip != null)
                {
                    query += string.Format("OFFSET {0} ", skip);
                }

                mySqlCmd = new MySqlCommand(query);
                reader   = PerformSqlQuery(mySqlCmd);

                var result = new List <Vouchers>();
                while (reader.Read())
                {
                    result.Add(constructObj(reader));
                }

                return(result);
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, mySqlCmd);
            }

            return(null);
        }
示例#5
0
 public void OnException(ExceptionContext filterContext)
 {
     if (filterContext.ExceptionHandled == false)
     {
         DBLogger dBLogger = new DBLogger
         {
             ErrorMEssgae   = filterContext.Exception.Message,
             StackTrace     = filterContext.Exception.StackTrace,
             ControllerName = filterContext.RouteData.Values["controller"].ToString(),
             ActionName     = filterContext.RouteData.Values["action"].ToString(),
             LoginDate      = DateTime.Now
         };
         ApplicationDbContext db = new ApplicationDbContext();
         db.DBLoggers.Add(dBLogger);
         db.SaveChanges();
         filterContext.ExceptionHandled = true;
     }
 }
示例#6
0
        public List <UserLogin> GetUsers(dynamic param)
        {
            List <UserLogin> _UserLogin = new List <UserLogin>();

            try
            {
                UserLoginRepo rp = new UserLoginRepo();
                _UserLogin = rp.GetAll();
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => GetUsers => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
            return(_UserLogin);
        }
示例#7
0
        public List <ErrorLogs> GetErrorLogsList(dynamic param)
        {
            List <ErrorLogs> _ErrorLogs = new List <ErrorLogs>();

            try
            {
                ErrorLogsRepo rp = new ErrorLogsRepo();
                _ErrorLogs = rp.GetAll().Where(p => p.UserLoginID == Convert.ToInt32(param.FilterParameter.UserLoginID)).ToList();
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => GetErrorLogsList => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
            return(_ErrorLogs);
        }
示例#8
0
        public UserLogin GetLoginUser(dynamic param)
        {
            UserLogin _UserLogin = new UserLogin();

            try
            {
                UserLoginRepo rp = new UserLoginRepo();
                _UserLogin = rp.GetLogin(param.FilterParameter.UserName.ToString(), param.FilterParameter.UserPassword.ToString());
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => GetLoginUser => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
            return(_UserLogin);
        }
示例#9
0
        public static ILogger CreateLogger(LogType type)
        {
            ILogger l = null;

            switch (type)
            {
            case LogType.FILE:

                l = new FileLogger(string.Format("{0}_{1}.log", AppConfiguration.ApplicationName, DateTime.Now.ToString("yyyyMMdd")));
                break;

            case LogType.DATABASE:
                l = new DBLogger(AppConfiguration.LogConnectionString);
                break;
            }

            return(l);
        }
示例#10
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int Id = Convert.ToInt32(hfDeleteId.Value);
            var q  = (from cc in db.CrisisCodes
                      where cc.Id == Id
                      select cc).FirstOrDefault();

            db.CrisisCodes.DeleteOnSubmit(q);

            db.SubmitChanges();
            this.gvCrisisCodes.DataBind();

            //audit trail
            DBLogger.Log("Delete", "Deleted Crisis Code", q.Name);

            //hide modal
            Javascript.HideModal(this, this, "deleteModal");
        }
示例#11
0
        public void DeleteUserByID(dynamic param)
        {
            List <UserLogin> _UserLogin = new List <UserLogin>();

            try
            {
                UserLoginRepo rp = new UserLoginRepo();
                int           ID = Convert.ToInt32(param.FilterParameter.ID);
                rp.DeleteByID(ID);
            }
            catch (Exception ex)
            {
                DBLogger loger = new DBLogger(Convert.ToInt32(param.FilterParameter.UserLoginID));
                loger.LogMessage = "Apı  => DeleteUserByID => Exception : " + ex.Message;
                LogManager lm = new LogManager(loger);
                lm.LogMe();
            }
        }
示例#12
0
        public List <Model.Fleet> Get(string limit, string skip)
        {
            MySqlCommand    mySqlCmd = null;
            MySqlDataReader reader   = null;

            try
            {
                // add to job order status
                string query = string.Format("SELECT * FROM {0} WHERE deleted=0 ORDER BY creation_date DESC ",
                                             TABLE_FLEETS);

                if (limit != null)
                {
                    query += string.Format("LIMIT {0} ", limit);
                }

                if (skip != null)
                {
                    query += string.Format("OFFSET {0} ", skip);
                }

                mySqlCmd = new MySqlCommand(query);
                reader   = PerformSqlQuery(mySqlCmd);

                List <Model.Fleet> fleetList = new List <Model.Fleet>();
                while (reader.Read())
                {
                    fleetList.Add(constructFleetObj(reader));
                }

                return(fleetList);
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, mySqlCmd);
            }

            return(null);
        }
示例#13
0
        public Model.Company GetCompanyById(string companyId)
        {
            MySqlCommand    mySqlCmd = null;
            MySqlDataReader reader   = null;

            try
            {
                Dictionary <string, string> queryParam = new Dictionary <string, string>();
                queryParam.Add("id", companyId);

                mySqlCmd = GenerateQueryCmd(TABLE_COMPANIES, queryParam);
                reader   = PerformSqlQuery(mySqlCmd);

                if (false == reader.Read())
                {
                    return(null);
                }

                var result = constructObj(reader);

                // query the admin
                var admins = new UsersDao().GetUserByCompanyId(companyId, "2", null, null);  // fixed Company-admin to 2
                if (admins != null)
                {
                    result.admin = admins.ToArray();
                }

                // query the rating
                result.rating = new JobDeliveryDao().GetRatingByCompany(companyId);

                return(result);
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, mySqlCmd);
            }

            return(null);
        }
示例#14
0
        protected void btnConfirmCancellation_Click(object sender, EventArgs e)
        {
            var gc = (from tr in db.GCTransactions
                      where tr.GCNumber == Request.QueryString["gcId"]
                      select tr).FirstOrDefault();

            gc.ApprovalStatus     = "Pending";
            gc.StatusGC           = "Cancelled";
            gc.CancellationReason = txtCancellationReason.Text;
            gc.CancelledDate      = DateTime.Now;

            db.SubmitChanges();

            //audit trail
            DBLogger.Log("Cancelled", "Cancelled GC Number: View from Front Office, Set status to " + gc.StatusGC,
                         gc.GCNumber);

            Response.Redirect("~/fo/frontoffice.aspx");
        }
示例#15
0
        public string Add(Model.Address payload, string jobId, string customerName, string contact, EType type)
        {
            MySqlCommand    command = null;
            MySqlDataReader reader  = null;

            try
            {
                var    destinationTable = (type == EType.From ? TABLE_JOB_FROM : TABLE_JOB_TO);
                string query            = string.Format("INSERT into {0} (add_1, add_2, add_3, state_id, country_id, postcode, gps_longitude, gps_latitude, create_by)" +
                                                        "VALUES (@add_1, @add_2, @add_3, @state_id, @country_id, @postcode, @gps_longitude, @gps_latitude, @create_by); " +
                                                        "INSERT into {1} (address_id, job_id, customer_name, customer_contact) " +
                                                        "VALUES (LAST_INSERT_ID(), @job_id, @customer_name, @customer_contact)",
                                                        TABLE_ADD, destinationTable);

                command = new MySqlCommand(query);
                command.Parameters.AddWithValue("@add_1", payload.address1);
                command.Parameters.AddWithValue("@add_2", payload.address2);
                command.Parameters.AddWithValue("@add_3", payload.address3);
                command.Parameters.AddWithValue("@state_id", payload.stateId);
                command.Parameters.AddWithValue("@country_id", payload.countryId);
                command.Parameters.AddWithValue("@postcode", payload.postcode);
                command.Parameters.AddWithValue("@gps_longitude", payload.gpsLongitude);
                command.Parameters.AddWithValue("@gps_latitude", payload.gpsLatitude);
                command.Parameters.AddWithValue("@create_by", payload.createdBy);

                command.Parameters.AddWithValue("@job_id", jobId);
                command.Parameters.AddWithValue("@customer_name", customerName);
                command.Parameters.AddWithValue("@customer_contact", contact);

                return(PerformSqlNonQuery(command).ToString());
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Error, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, command);
            }

            return(null);
        }
示例#16
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            int Id = Convert.ToInt32(hfEditId.Value);
            var q  = (from cc in db.CrisisCodes
                      where cc.Id == Id
                      select cc).FirstOrDefault();

            q.Code = txtEditCrisisCode.Text;
            q.Name = txtEditCrisisName.Text;

            db.SubmitChanges();
            this.gvCrisisCodes.DataBind();

            //audit trail
            DBLogger.Log("Update", "Updated Crisis Code", q.Name);

            //hide modal
            Javascript.HideModal(this, this, "updateModal");
        }
示例#17
0
        private bool ZipFileOperation(string fileName, string md5, string filePathAll)
        {
            string newZipFilePath = FileHelper.CopyTo(filePathAll);

            if (md5 == Common.Md5(newZipFilePath))
            {
                if (Operation.UnZipOperation(newZipFilePath))
                {
                    DBLogger.Insert(DBLogger.GetLoggerInfo(fileName, "上传的签名zip文件解压缩成功", 1));
                    return(true);
                }
                DBLogger.Insert(DBLogger.GetLoggerInfo(fileName, "上传的签名zip文件解压缩失败", 0));
                return(false);
            }
            else
            {
                DBLogger.Insert(DBLogger.GetLoggerInfo(fileName, "上传的签名zip文件验证不正确", 0));
                return(false);
            }
        }
示例#18
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Dining dining = new Dining();

            dining.Name = txtAddDining.Text;

            db.Dinings.InsertOnSubmit(dining);

            db.SubmitChanges();
            this.gvDining.DataBind();

            //audit trail
            DBLogger.Log("Create", "Create Dining ", dining.Name);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#addModal').modal('hide');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "HideShowModalScript", sb.ToString(), false);
        }
示例#19
0
 public static void WriteLogToDB(string projectSource, string logLevel, String log, Exception exception)
 {
     try
     {
         SqlDataAccess     SqlData      = new SqlDataAccess();
         DynamicParameters objParameter = new DynamicParameters();
         DBLogger          objDBLogger  = new DBLogger();
         objDBLogger.Message = log + (exception != null ? "\n\n exception:" + exception.ToString() : "");
         objDBLogger.Type    = logLevel;
         objDBLogger.Source  = projectSource;
         objParameter.Add("p_ID", objDBLogger.ExceptionID);
         objParameter.Add("p_Message", objDBLogger.Message);
         objParameter.Add("p_Type", objDBLogger.Type);
         objParameter.Add("p_Source", objDBLogger.Source);
         SqlData.dataContext.QuerySingle <DBResponse>("USP_INSERT_EXCEPTIONLOG", objParameter, commandType: CommandType.StoredProcedure);
     }
     catch
     {
     }
 }
示例#20
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            var q = (from r in db.Dinings
                     where r.Id.Equals(Convert.ToInt32(lblRowId.Text))
                     select r).FirstOrDefault();

            q.Name = txtEditDining.Text;

            db.SubmitChanges();
            this.gvDining.DataBind();

            //audit trail
            DBLogger.Log("Update", "Update Dining ", q.Name);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#updateModal').modal('hide');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript", sb.ToString(), false);
        }
示例#21
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            var q = (from r in db.Dinings
                     where r.Id == Convert.ToInt32(hfDeleteId.Value)
                     select r).FirstOrDefault();

            db.Dinings.DeleteOnSubmit(q);
            db.SubmitChanges();

            this.gvDining.DataBind();

            //audit trail
            DBLogger.Log("Delete", "Deleted Dining ", q.Name);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#deleteModal').modal('hide');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteHideModalScript", sb.ToString(), false);
        }
示例#22
0
        public List <string> GenerateVouchers(int numberOfVouchers, string namePrefix, float minPurchase, float percentageDiscount, DateTime expiredDate, int maxChars)
        {
            MySqlCommand    mySqlCmd = null;
            MySqlDataReader reader   = null;

            try
            {
                string query = string.Format("insert into {0} (name, end_date, voucher_type_id, discount_value, minimum_purchase, code, quantity) values ",
                                             TABLE_VOUCHER);

                List <string> promoCodeList = new List <string>();
                for (int count = 1; count <= numberOfVouchers; count++)
                {
                    string promoCode = Guid.NewGuid().ToString().Substring(1, maxChars);
                    promoCodeList.Add(promoCode);

                    query += string.Format("('{0}-{1}', '{2}', {3}, {4}, {5}, '{6}', 1),",
                                           namePrefix, count, expiredDate.ToString("yyyy-MM-dd hh:mm:ss"), 1, percentageDiscount, minPurchase, promoCode);
                }

                // remove the last comma
                query = query.Substring(0, query.Length - 1);

                mySqlCmd = new MySqlCommand(query);
                if (0 != PerformSqlNonQuery(mySqlCmd))
                {
                    return(promoCodeList);
                }
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, mySqlCmd);
            }

            return(null);
        }
示例#23
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //insert rooms
            var tmpRoom = (from tmp in db.tmpRooms
                           where tmp.UserId == Guid.Parse(Membership.GetUser().ProviderUserKey.ToString())
                           select tmp).ToList();

            foreach (var t in tmpRoom)
            {
                GCTransaction tran = new GCTransaction();
                tran.GuestId    = Convert.ToInt32(Request.QueryString["guestid"]);
                tran.Property   = t.Property;
                tran.GCNumber   = t.GCNumber;
                tran.DateIssued = Convert.ToDateTime(txtDateIssued.Text);
                tran.GCType     = ddlGCType.SelectedItem.Text;

                if (txtExpirationDate.Text != String.Empty)
                {
                    tran.ExpirationDate = Convert.ToDateTime(txtExpirationDate.Text);
                }

                tran.CreatedBy      = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
                tran.StatusGC       = "Pending";
                tran.ApprovalStatus = "Pending";
                tran.IsArchive      = false;
                tran.RoomId         = t.RoomId;
                tran.DiningId       = t.DiningId;
                tran.DiningTypeId   = t.DiningTypeId;
                tran.WithBreakfast  = t.WithBreakfast;
                tran.HeadCount      = t.HeadCount;
                tran.Remarks        = t.Remarks;

                db.GCTransactions.InsertOnSubmit(tran);
                db.SubmitChanges();

                //audit trail
                DBLogger.Log("Create", "Created GC", tran.GCNumber);
            }

            Response.Redirect("~/guest/default.aspx");
        }
示例#24
0
        public Model.DriverLocation GetByUserId(string userId)
        {
            MySqlCommand    mySqlCmd = null;
            MySqlDataReader reader   = null;

            try
            {
                string query = string.Format("SELECT {0}.*, {1}.id as driverId, {1}.display_name as driverName, {3}.id as companyId, {3}.name as companyName, " +
                                             "{6}.id as fleetId, {6}.registration_number as fleetNumber, {6}.fleet_types_id as fleetTypeId, {4}.job_id as ongoingJobId " +
                                             "FROM (SELECT *, MAX(creation_date) FROM {0} GROUP BY user_id DESC) AS {0} " +
                                             "INNER JOIN {1} ON {1}.id={0}.user_id " +
                                             "INNER JOIN {2} ON {2}.user_id={0}.user_id " +
                                             "INNER JOIN {3} ON {3}.id={2}.company_id " +
                                             "LEFT JOIN {4} ON {4}.driver_user_id={0}.user_id AND {4}.company_id={3}.id " +
                                             "LEFT JOIN (SELECT * FROM {5} GROUP BY {5}.job_id) {5} ON {5}.job_id={4}.job_id AND {5}.job_status_id in (@job_status_id) " +
                                             "LEFT JOIN {6} ON {6}.id={4}.fleet_id " +
                                             "WHERE {0}.user_id=@driverId",
                                             TABLE_USER_TRACKING, TABLE_USERS, TABLE_USER_COMPANY, TABLE_COMPANIES, TABLE_JOB_DELIVERY, TABLE_JOB_STATUS, TABLE_FLEETS);

                mySqlCmd = new MySqlCommand(query);
                mySqlCmd.Parameters.AddWithValue("@job_status_id", string.Format("{0},{1}", (int)JobStatus.Ongoing_Delivery, (int)JobStatus.Ongoing_Pickup));
                mySqlCmd.Parameters.AddWithValue("@driverId", userId);

                reader = PerformSqlQuery(mySqlCmd);
                if (reader.Read())
                {
                    return(constructObj(reader));
                }
            }
            catch (Exception e)
            {
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.Message);
                DBLogger.GetInstance().Log(DBLogger.ESeverity.Info, e.StackTrace);
            }
            finally
            {
                CleanUp(reader, mySqlCmd);
            }

            return(null);
        }
示例#25
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            var q = (from g in db.Guests
                     where g.Id.Equals(hfDeleteId.Value)
                     select g).FirstOrDefault();

            db.Guests.DeleteOnSubmit(q);
            db.SubmitChanges();

            //bindGridview();
            gvGuests.DataBind();

            //audit trail
            DBLogger.Log("Delete", "Deleted Individual", q.GuestId);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#deleteModal').modal('hide');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteHideModalScript", sb.ToString(), false);
        }
示例#26
0
 public string DoFileThread(string clientUser, string GuidStr, string yljgbm)
 {
     try
     {
         //文件处理是否已经启动 true:已经启动  false:未启动
         if (Checker.DoFileIsExcute(clientUser) == false)
         {
             startThread(clientUser, GuidStr, yljgbm);
         }
         TxtLogger.Debug(string.Format("{0}:[{1} {2}]]", "DoFileThread", clientUser, "上传数据处理程序启动"));
         DBLogger.Insert(new LoggerInfo(clientUser, "DoFileThread上传数据处理程序启动", 1));
     }
     catch (Exception ex)
     {
         TxtLogger.Error(string.Format("{0}:[{1} {2}]:[{3}]", "DoFileThread", clientUser, "上传数据处理程序启动异常", ex.Message));
         DBLogger.Insert(new LoggerInfo(clientUser,
                                        string.Format("DoFileThread上传数据处理程序启动异常,{0}", ex.Message), 0));
         return(string.Format("0-{0}-{1}", "DoFileThread", ex.Message));
     }
     return(string.Format("1-{0}-{1}", "DoFileThread", "正常结束"));
 }
示例#27
0
        protected void btnConfirmDisapproveGC_Click(object sender, EventArgs e)
        {
            int Id   = Convert.ToInt32(hfDisapproveGCId.Value);
            var tran = (from gc in db.GCTransactions
                        where gc.Id == Id
                        select gc).FirstOrDefault();

            tran.ApprovalStatus = "Disapproved";

            db.SubmitChanges();
            this.gvGC.DataBind();

            //audit trail
            DBLogger.Log("Disapproved", "Disapproved GC", tran.GCNumber);

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(@"<script type='text/javascript'>");
            sb.Append("$('#disapproveModal').modal('hide');");
            sb.Append(@"</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditShowModalScript", sb.ToString(), false);
        }
示例#28
0
        public void TestDBLog()
        {
            if (File.Exists(logPath))
            {
                File.Delete(logPath);
            }

            string  actual   = "";
            string  expected = "raz dwa trzy proba mikrofonu";
            ILogger log      = new DBLogger();

            log.Log(expected);
            using (var db = new TPAEntities())
            {
                // var query = from Log in db.LogSet
                //      select Log.Message;

                // actual = query.FirstOrDefault<Log>();
            }
            Assert.AreEqual(expected, actual);
        }
示例#29
0
        public Response Post(string uniqueId, float rating)
        {
            if (rating > 5)
            {
                DBLogger.GetInstance().Log(Utility.DBLogger.ESeverity.Warning, "SetRating, " + uniqueId + "," + rating);
                response = Utility.Utils.SetResponse(response, false, Constant.ErrorCode.EParameterError);
                return(response);
            }

            var jobId = Utils.DecodeUniqueId(uniqueId);

            if (false == jobDeliveryDao.UpdateRating(jobId, rating))
            {
                response = Utility.Utils.SetResponse(response, false, Constant.ErrorCode.EGeneralError);
                return(response);
            }

            // notify company admin rating update
            var companyAdminsIdentifiers = userDao.GetDeliveryComIdentifierByJobId(jobId, ((int)Constants.Configuration.Role.CompanyAdmin).ToString());

            if (companyAdminsIdentifiers.Count > 0)
            {
                var jobDetails = jobDetailsDao.GetByJobId(jobId);
                var extraData  = Helper.PushNotification.ConstructExtraData(Helper.PushNotification.ECategories.RatingUpdate, jobId);

                var description = NotificationMsg.JobRating_Desc.Replace("@rating", rating.ToString());
                description = description.Replace("@jobId", jobId.ToString());
                description = description.Replace("@from", jobDetails.addressFrom[0].address3);

                Utility.UtilNotification.BroadCastMessage(
                    companyAdminsIdentifiers.ToArray(),
                    extraData,
                    NotificationMsg.JobRating_Title,
                    description
                    );
            }

            response = Utility.Utils.SetResponse(response, true, Constant.ErrorCode.ESuccess);
            return(response);
        }
示例#30
0
        protected void btnAddUser_Click(object sender, EventArgs e)
        {
            //chk if username already exist
            if (Membership.GetUser(txtCreateUsername.Text) != null)
            {
                lblErrorMsg.Text = "Username already exist.";
            }
            else
            {
                //register user
                Membership.CreateUser(txtCreateUsername.Text,
                                      txtCreateUsername.Text.Trim());

                //add to user profile
                UserProfile user = new UserProfile();
                user.UserId     = Guid.Parse(Membership.GetUser(txtCreateUsername.Text).ProviderUserKey.ToString());
                user.FirstName  = txtCreateFirstName.Text;
                user.MiddleName = txtCreateMiddleName.Text;
                user.LastName   = txtCreateLastName.Text;
                user.PositionId = 1;
                dbUser.UserProfiles.InsertOnSubmit(user);
                dbUser.SubmitChanges();

                //assign role
                Roles.AddUserToRole(txtCreateUsername.Text, ddlCreateRoles.SelectedItem.Text);

                //re-load users
                this.gvUsers.DataBind();

                //audit trail
                DBLogger.Log("Create", "Created User: "******"<script type='text/javascript'>");
                sb.Append("$('#createUser').modal('hide');");
                sb.Append(@"</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteShowModalScript", sb.ToString(), false);
            }
        }