Ejemplo n.º 1
0
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DataGridViewSelectedRowCollection col = dgvList.SelectedRows;
         if (col.Count < 1)
         {
             MessageBox.Show("请选择要删除的行");
             return;
         }
         if (MessageBox.Show("确定要删除选定的行吗 ?数据删除后将不能恢复,点击【确定】删除数据,【取消】不删除", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
         {
             return;
         }
         int       index = col[0].Index;
         DataTable dt    = dgvList.DataSource as DataTable;
         DataRow   row   = dt.Rows[index];
         string    id    = row["Id"].ToString();
         string    sql   = "Delete from EventWaring where Id='" + id + "'";
         if (DBHelper.ExecuteNonQuery(sql) > 0)
         {
             MessageBox.Show("删除成功");
             InItList();
         }
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(frmEventWaring));
     }
 }
Ejemplo n.º 2
0
 private void btnQuery_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCardId.Text == "" && cmbxStatus.Text == "")
         {
             InitList();
             return;
         }
         if (dtOrg == null || dtOrg.Rows.Count < 1)
         {
             return;
         }
         DataRow[] rows = dtOrg.Select("1=1" + (txtCardId.Text.Trim() == "" ? "" : (" and CardID like'%" + txtCardId.Text.Trim() + "%'")) + (cmbxStatus.Text == "" ? "" : (" and status='" + cmbxStatus.Text + "'")));
         DataTable temp = dtOrg.Clone();
         foreach (DataRow row in rows)
         {
             DataRow dr = temp.NewRow();
             dr.ItemArray = row.ItemArray;
             temp.Rows.Add(dr);
         }
         dgvCardList.DataSource = temp;
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(frmCardMgr));
     }
 }
Ejemplo n.º 3
0
 public frmUserMgr()
 {
     InitializeComponent();
     dgvUserList.AutoGenerateColumns = false;
     InitList();
     try
     {
         string  sql = "select * from UserType where Sort=1";
         DataSet ds  = DBHelper.ExecuteDataSet(sql, null, null);
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             DataTable dt  = ds.Tables[0];
             DataRow   row = dt.NewRow();
             dt.Rows.InsertAt(row, 0);
             cbxUserType.DataSource    = dt;
             cbxUserType.DisplayMember = "UserTypeName";
             cbxUserType.ValueMember   = "ID";
         }
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(frmUserMgr));
         MessageBox.Show(ex.Message);
     }
     CommStatic.TxtBoxCardId = txtCardId;
     txtUserName.Focus();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Transforms an XML document content to an XML document content in another format by specifying an XSLT path
        /// </summary>
        /// <param name="xmlString">Original XML document content</param>
        /// <param name="xsltFilePath">XSLT path</param>
        /// <returns>Transformed XML document content</returns>
        public string GetTransformedXmlStringByXsltDocument(string xmlString, string xsltFilePath)
        {
            string returnValue = xmlString;

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { xmlString, xsltFilePath }, this.TraceSourceName);
            }

            XmlDocument document = new XmlDocument();

            document.LoadXml(xmlString);

            XslCompiledTransform transform = new XslCompiledTransform();

            transform.Load(xsltFilePath);

            StringWriter stringWriter = new StringWriter();

            transform.Transform(document, null, stringWriter);

            stringWriter.Flush();
            stringWriter.Close();

            returnValue = stringWriter.ToString();

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { document.InnerXml, xsltFilePath, transform, returnValue }, this.TraceSourceName);
            }

            return(returnValue);
        }
Ejemplo n.º 5
0
        private void InitUserType()
        {
            try
            {
                string  sql = "select Id,UserTypeName from UserType where Sort=@Sort";
                DataSet ds  = DBHelper.ExecuteDataSet(sql, new string[] { "@Sort" }, new object[] { 1 });
                if (ds == null || ds.Tables[0].Rows.Count < 1)
                {
                    return;
                }
                DataTable dt = ds.Tables[0];

                DataRow row = dt.NewRow();
                row["Id"]           = -100;
                row["UserTypeName"] = notVip;
                dt.Rows.InsertAt(row, 0);

                DataRow dr = dt.NewRow();
                dt.Rows.InsertAt(dr, 0);
                cbxUserType.DataSource    = dt;
                cbxUserType.DisplayMember = "UserTypeName";
                cbxUserType.ValueMember   = "ID";
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(frmConsumeHistory));
            }
        }
Ejemplo n.º 6
0
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         TreeNode node = tvList.SelectedNode;
         DataRow  row  = null;
         if (node != null && node.Tag is DataRow)
         {
             row = node.Tag as DataRow;
         }
         else
         {
             MessageBox.Show("只能删除产品或者服务名称节点,其他节点不能删除!");
             return;
         }
         if (MessageBox.Show("确定要删除此产品或者服务吗?删除之后数据将不能恢复,请谨慎操作,选【确定】删除,【取消】不删除", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
         {
             string sql = "delete from Product where Id=@Id";
             if (DBHelper.ExecuteNonQuery(sql, new string[] { "@Id" }, new object[] { row["Id"].ToString() }) > 0)
             {
                 sql = "delete from ProductMainPrice where ProductId=@Id";
                 DBHelper.ExecuteNonQuery(sql, new string[] { "@Id" }, new object[] { row["Id"].ToString() });
                 sql = "delete from ProductMemberShipPrice where ProductId=@Id";
                 DBHelper.ExecuteNonQuery(sql, new string[] { "@Id" }, new object[] { row["Id"].ToString() });
                 InitTv();
             }
         }
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(frmProductsMgr));
         MessageBox.Show(ex.Message);
     }
 }
        public object GetFileContentByEncoding(string filePath, string encodingName)
        {
            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { filePath, encodingName }, this.TraceSourceName);
            }

            FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);

            Encoding fileEncoding = String.IsNullOrEmpty(encodingName) ? Encoding.Default : Encoding.GetEncoding(encodingName);

            StreamReader reader = new StreamReader(fileStream, fileEncoding);

            string content = reader.ReadToEnd();

            reader.Close();

            fileStream.Close();

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { filePath, encodingName, fileEncoding.BodyName, content }, this.TraceSourceName);
            }

            return(content);
        }
Ejemplo n.º 8
0
        public string HandleText(RQBase info)
        {
            string xml = string.Empty;

            //文字处理
            try
            {
                switch (info.Content)
                {
                case "美女":    //输入美女
                    xml = new Btgirl().Execute(info.xmlmsg);
                    break;

                case "头条":    //头条
                    xml = new TouTiao().Execute(info.xmlmsg);
                    break;

                default:
                    RequestText voice = new RequestText();
                    voice.xmlmsg = info.xmlmsg;
                    //xml = new replyText().ReplyExecute(voice);
                    //xml = new DeepQA().Execute(info.xmlmsg);
                    break;
                }
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(WeixinApiDispatch), ex.Message);
            }
            TracingHelper.Info(" HandleText  " + xml);
            return(xml);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 成为开发者的第一步,验证并相应服务器的数据  企业号
        /// </summary>
        private void AuthQY()
        {
            try
            {
                string msg_signature = HttpContext.Current.Request.QueryString["msg_signature"];
                string timestamp     = HttpContext.Current.Request.QueryString["timestamp"];
                string nonce         = HttpContext.Current.Request.QueryString["nonce"];
                string echostr       = HttpContext.Current.Request.QueryString["echoStr"];

                int    ret      = 0;
                string sEchoStr = "";

                ret = wxcpt.VerifyURL(msg_signature, timestamp, nonce, echostr, ref sEchoStr);
                if (ret != 0)
                {
                    TracingHelper.Info("qy ERR: VerifyURL fail, ret: " + ret);
                    return;
                }
                TracingHelper.Info("qy sEchoStrt: " + sEchoStr);
                HttpContext.Current.Response.Write(sEchoStr);
                HttpContext.Current.Response.End();
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(handlerTop), ex.Message);
            }
        }
Ejemplo n.º 10
0
        private IList <IDictionary <string, object> > ExcecuteDataReader(DbConnection connection, string commandText, IDictionary <string, object> inputParameters, CommandType commandType)
        {
            IList <IDictionary <string, object> > returnValue = null;
            DbCommand dbCommand = connection.CreateCommand();

            dbCommand.CommandText = commandText;
            dbCommand.CommandType = commandType;

            if (inputParameters != null)
            {
                if (inputParameters.Count > 0)
                {
                    foreach (string paramName in inputParameters.Keys)
                    {
                        DbParameter parameter = dbCommand.CreateParameter();

                        parameter.Direction     = ParameterDirection.Input;
                        parameter.ParameterName = paramName;
                        parameter.Value         = inputParameters[paramName];

                        dbCommand.Parameters.Add(parameter);
                    }
                }
            }

            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }

            DbDataReader dataReader = dbCommand.ExecuteReader(CommandBehavior.CloseConnection);

            returnValue = new List <IDictionary <string, object> >();

            while (dataReader.Read())
            {
                IDictionary <string, object> record = new Dictionary <string, object>();

                for (int i = 0; i < dataReader.FieldCount; i++)
                {
                    record.Add(dataReader.GetName(i), dataReader.GetValue(i));
                }

                returnValue.Add(record);
            }

            dataReader.Close();

            if (connection.State != ConnectionState.Closed)
            {
                connection.Close();
            }

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { connection, commandText, commandType, inputParameters, returnValue }, this.TraceSourceName);
            }

            return(returnValue);
        }
Ejemplo n.º 11
0
 private void Init()
 {
     try
     {
         string  sql = "select * from SysConfig where key='StartWorkTimeSetting' or key='GoOffWorkTimeSetting'";
         DataSet ds  = DBHelper.ExecuteDataSet(sql);
         if (ds == null || ds.Tables[0].Rows.Count < 2)
         {
             return;
         }
         DataTable dt = ds.Tables[0];
         if (dt.Rows[0]["key"].ToString() == "StartWorkTimeSetting")
         {
             row0 = dt.Rows[0];
             row1 = dt.Rows[1];
         }
         else
         {
             row0 = dt.Rows[1];
             row1 = dt.Rows[0];
         }
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(frmCheckOnMgr));
     }
 }
Ejemplo n.º 12
0
        public object GetData(string providerName, string connectionString, string dataTableName, string commandText, string commandType, string outputEncodingName)
        {
            object returnValue = null;

            DbConnection connection = this.getDbConnection(providerName);

            connection.ConnectionString = connectionString;

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { providerName, connectionString, commandText, commandType, outputEncodingName }, this.TraceSourceName);
            }

            DbDataAdapter dataAdapter = this.getDbDataAdapter(providerName);

            Encoding outputEncoding = String.IsNullOrEmpty(outputEncodingName) ? Encoding.Default : Encoding.GetEncoding(outputEncodingName);

            returnValue = this.getDataSetXml(dataAdapter, connection, dataTableName, commandText, null, this.getDbCommandType(commandType), outputEncoding);

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { returnValue, outputEncoding.BodyName }, this.TraceSourceName);
            }

            return(returnValue);
        }
Ejemplo n.º 13
0
        private DataRow getFilteredDataRow(IDictionary <string, object> item, string[] columnNames, DataTable table)
        {
            int matchCount = 0;

            for (int j = 0; j < table.Rows.Count; j++)
            {
                if (table.Rows[j].RowState != DataRowState.Deleted)
                {
                    for (int i = 0; i < columnNames.Length; i++)
                    {
                        if (table.Rows[j][columnNames[i]].ToString() == item[columnNames[i]].ToString())
                        {
                            matchCount++;
                        }
                    }

                    if (matchCount == columnNames.Length)
                    {
                        if (this.EnableTracing)
                        {
                            TracingHelper.Trace(new object[] { table.Rows[j].ItemArray, columnNames }, this.TraceSourceName);
                        }

                        return(table.Rows[j]);
                    }
                }
            }


            return(null);
        }
Ejemplo n.º 14
0
        public object Query(string providerName, string connectionString, string commandText, string commandType, OperationMethod queryMode)
        {
            object returnValue = null;

            DbConnection connection = this.getDbConnection(providerName);

            connection.ConnectionString = connectionString;

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { connection, commandText, commandType, queryMode }, this.TraceSourceName);
            }

            if ((connection != null) && (!String.IsNullOrEmpty(commandText)))
            {
                //if (queryMode == OperationMethod.Retrieve)
                //{
                //    DbDataAdapter dataAdapter = this.getDbDataAdapter(providerName);

                //    returnValue = this.getDataSetXml(dataAdapter, connection, commandText, null, this.getDbCommandType(commandType));
                //}
                //else
                {
                    returnValue = this.beginQuery(connection, commandText, commandType, queryMode);
                }
            }

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { connection, commandText, commandType, queryMode, returnValue }, this.TraceSourceName);
            }

            return(returnValue);
        }
Ejemplo n.º 15
0
        public void CorrectLoggerImplementationIsConstructed()
        {
            var logger = new ConsoleLogger(LogLevel.None);
            var t      = new TracingHelper(logger);

            Assert.AreEqual(nameof(ConsoleLogger), t.LoggerImplementationType);
        }
Ejemplo n.º 16
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("确定要删除这条促销计划吗?数据删除后将不能再恢复,点击【确定】删除数据,【取消】不删除", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
                {
                    return;
                }
                DataGridViewSelectedRowCollection col = dgvList.SelectedRows;
                if (col.Count < 1)
                {
                    MessageBox.Show("请在下面列表选择要删除的促销计划!");
                    return;
                }

                DataGridViewRow dgvRow = col[0];
                int             index  = dgvRow.Index;
                DataTable       dt     = dgvList.DataSource as DataTable;
                DataRow         row    = dt.Rows[index];
                string          id     = row["Id"].ToString();
                string          sql    = "delete from ProductMainPrice where Id='" + id + "'";
                if (DBHelper.ExecuteNonQuery(sql, null, null) > 0)
                {
                    sql = "delete from ProductMemberShipPrice where ProductId=@ProductId and ProductMainPriceId=@ProductMainPriceId";
                    DBHelper.ExecuteNonQuery(sql, new string[] { "@ProductId", "@ProductMainPriceId" }, new object[] { this.productId, id });
                    InitList();
                    MessageBox.Show("删除成功!");
                }
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(ucPromoteDiscount));
            }
        }
Ejemplo n.º 17
0
        public static async Task Main(string[] args)
        {
            var    loggerFactory = new LoggerFactory().AddConsole();
            Tracer tracer        = TracingHelper.InitTracer("client", loggerFactory);
            ClientTracingInterceptor tracingInterceptor = new ClientTracingInterceptor(tracer);


            Channel channel = new Channel($"{Server}:{Port}", ChannelCredentials.Insecure);

            var    client = new gRPCService.gRPCServiceClient(channel.Intercept(tracingInterceptor));
            string user   = "******";

            var reply = client.SayHello(new HelloRequest {
                Name = user, SendDate = DateTime.UtcNow.ToTimestamp()
            });

            Console.WriteLine("Greeting: " + reply.ResponseMsg);


            var response = client.SayGoodbye(new GoodByeRequest()
            {
                Name = user
            });

            Console.WriteLine("Response: " + response.ResponseMsg);

            await channel.ShutdownAsync();

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Ejemplo n.º 18
0
        public void ProcessRequest(HttpContext context)
        {
            string postString = string.Empty;

            if (HttpContext.Current.Request.HttpMethod.ToUpper() == "POST")
            {
                using (Stream stream = HttpContext.Current.Request.InputStream)
                {
                    Byte[] postBytes = new Byte[stream.Length];
                    stream.Read(postBytes, 0, (Int32)stream.Length);
                    postString = Encoding.UTF8.GetString(postBytes);
                }

                if (!string.IsNullOrEmpty(postString))
                {
                    TracingHelper.Info("Post " + postString);
                    Execute(postString);
                }
            }
            //else if (HttpContext.Current.Request.HttpMethod.ToUpper() == "GET")
            //{
            //    TracingHelper.Info("Get " + postString);
            //    Execute(postString);
            //}
            else
            {
                TracingHelper.Info("Url:  " + HttpContext.Current.Request.Url.ToString());
                Auth();
            }
        }
Ejemplo n.º 19
0
 private void InitList()
 {
     try
     {
         string sql       = "select a.*,b.Name as AdminType from Admin as a left join AdminRole as b on a.rights=b.Id {0} order by a.CreateTime desc";
         string wherePart = "";
         if (!Caps.HasCaps(((int)Caps.Roles.AdminMgr).ToString()))//拥有这个权限才能看全部,没有的只能看自己;
         {
             wherePart = " where a.Id='" + CommStatic.MyCache.Login.Id + "' ";
         }
         sql = string.Format(sql, wherePart);
         DataSet ds = DBHelper.ExecuteDataSet(sql, null, null);
         if (ds == null || ds.Tables[0].Rows.Count < 1)
         {
             return;
         }
         DataTable  dt  = ds.Tables[0];
         DataColumn col = dt.Columns.Add("state", typeof(Byte[]));
         foreach (DataRow row in ds.Tables[0].Rows)
         {
             //row["Rights"] = row["Rights"].ToString() == "1" ? "超级管理员" : "普通管理员";
             row["state"] = row["Active"].ToString() == "1" ? BitmapToBytes(Properties.Resources.OK) : BitmapToBytes(Properties.Resources.stop);
         }
         dgvAdminList.DataSource = ds.Tables[0];
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(frmAdminMgr));
     }
 }
Ejemplo n.º 20
0
        /// <summary>
        /// 检查 Signature
        /// </summary>
        /// <returns></returns>
        private bool checkSignature(string token, string signature, string timestamp, string nonce)
        {
            try
            {
                //1.组成数组
                var tmpArr = new string[] { token, timestamp, nonce };
                //2.数组排序
                Array.Sort(tmpArr);
                //3.转成字符串
                string tmpStr = string.Join("", tmpArr);
                //4.sha1 散列
                string hash = FormsAuthentication.HashPasswordForStoringInConfigFile(tmpStr, "SHA1");
                hash = hash.ToLower();


                if (signature.Equals(hash))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(handler), ex.Message);
                return(false);
            }
        }
        public void WriteFileContentByEncoding(string filePath, string fileConent, string encodingName)
        {
            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { filePath, fileConent, encodingName }, this.TraceSourceName);
            }

            FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Write);

            Encoding fileEncoding = String.IsNullOrEmpty(encodingName) ? Encoding.Default : Encoding.GetEncoding(encodingName);

            StreamWriter writer = new StreamWriter(fileStream, fileEncoding);

            writer.Write(fileConent);

            writer.Flush();

            fileStream.Flush();

            writer.Close();

            fileStream.Close();

            if (this.EnableTracing)
            {
                TracingHelper.Trace(new object[] { filePath, fileEncoding.BodyName }, this.TraceSourceName);
            }
        }
Ejemplo n.º 22
0
 public void InitData(DataRow _row, int _priceType, string _productId)
 {
     try
     {
         this.row         = _row;
         this.priceType   = _priceType;
         this.productId   = _productId;
         TvList.ImageList = imageList1;
         if (this.row != null && this.row["MarketPrice"] != null && this.row["MarketPrice"].ToString() != "")
         {
             txtBasicPrice.Text = row["MarketPrice"].ToString();
         }
         else
         {
             txtBasicPrice.Text              = "";
             txtDiscountPrice.Text           = "";
             txtDiscountRate.Text            = "";
             radioButtonDiscountRate.Checked = true;
         }
         panelRight.Enabled = false;
         InitTv();
         radioButtonDiscountRate_CheckedChanged(null, null);
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(ucCommProductPrice));
     }
 }
        private static Server GenerateServerInstance()
        {
            PrintLogAndConsole("Initialize gRPC server ...");

            ILoggerFactory           loggerFactory      = new LoggerFactory().AddConsole();
            var                      serviceName        = "MockSite.DomainService";
            Tracer                   tracer             = TracingHelper.InitTracer(serviceName, loggerFactory);
            ServerTracingInterceptor tracingInterceptor = new ServerTracingInterceptor(tracer);

            var host = AppSettingsHelper.Instance.GetValueFromKey(HostNameConst.TestKey);
            var port = Convert.ToInt32(AppSettingsHelper.Instance.GetValueFromKey(PortConst.TestKey));

            var server = new Server
            {
                Ports =
                {
                    new ServerPort(host, port, ServerCredentials.Insecure)
                }
            };

            Console.WriteLine($"Greeter server listening on host:{host} and port:{port}");

            server.Services.Add(
                Message.UserService.BindService(
                    new UserServiceImpl(ContainerHelper.Instance.Container.Resolve <IUserService>())).Intercept(tracingInterceptor));
            return(server);
        }
Ejemplo n.º 24
0
 public void InitTv()
 {
     try
     {
         string  sql = "select * from UserType where Sort=1";
         DataSet ds  = DBHelper.ExecuteDataSet(sql, null, null);
         TvList.Nodes.Clear();
         if (ds == null || ds.Tables[0].Rows.Count < 1)
         {
             return;
         }
         DataTable  dt    = ds.Tables[0];
         TreeNode[] nodes = new TreeNode[dt.Rows.Count];
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             DataRow row = dt.Rows[i];
             nodes[i]            = new TreeNode();
             nodes[i].Text       = row["UserTypeName"].ToString();
             nodes[i].Tag        = row["Id"].ToString();
             nodes[i].ImageIndex = 0;
         }
         TvList.ExpandAll();
         TvList.Nodes.AddRange(nodes);
         TvList.SelectedNode = nodes[0];
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(ucCommProductPrice));
     }
 }
Ejemplo n.º 25
0
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DataGridViewSelectedRowCollection col = dgvList.SelectedRows;
         if (col.Count < 1)
         {
             MessageBox.Show("请选择要删除的项目");;
             return;
         }
         if (MessageBox.Show("确定要删除所选项目吗?删除后数据将不能恢复,【是】继续删除,【否】不删除", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
         {
             return;
         }
         DataGridViewRow row = col[0];
         DataTable       dt  = dgvList.DataSource as DataTable;
         DataRow         dr  = dt.Rows[row.Index];
         string          sql = "delete from UserType where ID=@ID";
         if (DBHelper.ExecuteNonQuery(sql, new string[] { "@ID" }, new object[] { dr["ID"].ToString() }) > 0)
         {
             MessageBox.Show("删除成功!");
             InitList();
         }
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(UCUserTypeAndEmployeeMgr));
     }
 }
Ejemplo n.º 26
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.row == null)
         {
             MessageBox.Show("请先查找要充值的用户信息");
             return;
         }
         string money = txtReChargeMoney.Text;
         if (string.IsNullOrEmpty(money))
         {
             MessageBox.Show("请输入充值金额");
             return;
         }
         float m;
         if (!float.TryParse(money, out m))
         {
             MessageBox.Show("充值金额必须是半角数字,请重新输入");
             return;
         }
         string sql = "Update User set Money=" + (float.Parse(row["Money"].ToString()) + m) + " where Id='" + row["Id"].ToString() + "'";
         if (DBHelper.ExecuteNonQuery(sql) > 0)
         {
             btnQuery_Click(sender, e);
             txtReChargeMoney.Text = "";
             MessageBox.Show("充值成功!最新余额" + txtCountMoney.Text + "元");
         }
     }
     catch (Exception ex)
     {
         TracingHelper.Error(ex, typeof(frmRechargecs));
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 27
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtFilePath.Text == "" || !File.Exists(txtFilePath.Text))
                {
                    MessageBox.Show("所选择的路径不存在,请选择正确的文件路径");
                    return;
                }
                string        lineData;
                StringBuilder sb = new StringBuilder();
                using (StreamReader reader = new StreamReader(txtFilePath.Text, Encoding.UTF8))
                {
                    lineData = reader.ReadLine();
                    string[] col;
                    string   sql;
                    while (!string.IsNullOrEmpty(lineData))
                    {
                        string clearTxt = Tools.Tools.Decrypt(lineData);//解除明文
                        col = clearTxt.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        if (col.Length != 4)
                        {
                            sb.Append("------(非法数据)");
                            goto gotoHere;//跳过
                        }
                        sql = "select * from Card where CardID=@CardID";
                        DataSet ds = DBHelper.ExecuteDataSet(sql, new string[] { "@CardID" }, new object[] { col[0] });
                        if (ds != null && ds.Tables[0].Rows.Count > 0)
                        {
                            sb.AppendLine(lineData + "------(卡已经存在)");
                            goto gotoHere;
                        }
                        sql = "Insert into Card(ID,CardId,Status,Key,CreateTime,Org)values(@ID,@CardId,@Status,@Key,@CreateTime,@Org)";
                        string[] prm = new string[] { "@ID", "@CardId", "@Status", "@Key", "@CreateTime", "@Org" };
                        object[] obj = new object[] { Guid.NewGuid().ToString("N"), col[0], col[1], col[2], DateTime.Parse(col[3]), lineData };
                        if (DBHelper.ExecuteNonQuery(sql, prm, obj) < 1)
                        {
                            sb.AppendLine(lineData + "------(插入数据失败)");
                        }
gotoHere:
                        lineData = reader.ReadLine();
                    }
                }
                if (sb.Length > 0)
                {
                    Tools.TracingHelper.Error("有如下卡号导入失败:" + sb.ToString());
                    MessageBox.Show("有部分卡号导入失败,详情见日志!");
                }
                else
                {
                    MessageBox.Show("卡号导入成功!");
                }
                InitList();
                CommStatic.FrmMain.InitSystemInfo();
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(frmCardMgr));
            }
        }
Ejemplo n.º 28
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddOptions();
            services.AddSingleton <UserService.UserServiceBase, UserServiceImpl>();
            services.AddSingleton <IUserService, Core.Services.UserService>();
            services.AddSingleton <IUserRepository, UserRepository>();
            services.AddSingleton <IMongoUserRepository, MongoUserRepository>();
            services.AddSingleton <IRedisUserRepository, RedisUserRepository>();
            services.AddSingleton <RedisConnectHelper>();
            services.AddSingleton <CurrencyService.CurrencyServiceBase, CurrencyServiceImpl>();
            services.AddSingleton <LocalizationService.LocalizationServiceBase, LocalizationServiceImpl>();
            services.AddSingleton <ICurrencyService, Core.Services.CurrencyService>();
            services.AddSingleton <ILocalizationService, Core.Services.LocalizationService>();
            services.AddSingleton <ICurrencyRepository, CurrencyRepository>();
            services.AddSingleton <ILocalizationRepository, LocalizationRepository>();
            services.AddSingleton <UserRepositoryFactory>();
            services.AddSingleton <SqlConnectionHelper>();

            const string serviceName     = "MockSite.DomainService";
            var          serviceProvider = services.BuildServiceProvider();
            var          loggerFactory   = serviceProvider.GetRequiredService <ILoggerFactory>();
            var          tracer          = TracingHelper.InitTracer(serviceName, loggerFactory);

            services.AddGrpc(options => options.Interceptors.Add <ServerTracingInterceptor>(tracer));
        }
Ejemplo n.º 29
0
        public override string Execute(InfoBase json)
        {
            bool   connect = false;
            string xml     = string.Empty;

            try
            {
                //组建参数字典
                Dictionary <string, string> Para = new Dictionary <string, string>();
                Para.Add("num", "4");
                Para.Add("rand", "1");

                string     path    = RequestPath.CreatePathApi("/txapi/weixin/wxhot");
                RpArticles newList = HTMLHelper.Get <RpArticles>(path, Para, ref connect, ShareData.baiduapikey);
                if (newList.code == "200" && newList != null)
                {
                    newList.xmlmsg = json;
                    xml            = new replyImageText().ReplyExecute(newList);
                }
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(TouTiao), ex.Message);
            }
            return(xml);
        }
Ejemplo n.º 30
0
        public override string Execute(InfoBase json)
        {
            bool   connect = false;
            string xml     = string.Empty;

            try
            {
                //组建参数字典
                Dictionary <string, string> Para = new Dictionary <string, string>();
                //Para.Add("key", ShareData.QAkye);
                //Para.Add("info", json.Contents);
                //Para.Add("userid", ShareData.QAuserid);

                string     path    = RequestPath.CreatePathApi("/turing/turing/turing");
                RpArticles newList = HTMLHelper.Get <RpArticles>(path, Para, ref connect, ShareData.baiduapikey);
                if (newList.code == "200" && newList != null)
                {
                    newList.xmlmsg = json;
                    xml            = new replyImageText().ReplyExecute(newList);
                }
            }
            catch (Exception ex)
            {
                TracingHelper.Error(ex, typeof(DeepQA), ex.Message);
            }
            return(xml);
        }