private void btnOKClick() { this.Invoke(new Action(() => { ruleModel.CrName = txtRuleName.Text.Trim(); ruleModel.conTime = Convert.ToInt32(txtConTime.Text.Trim()); ruleModel.costBegin = Convert.ToDouble(txtCostBegin.Text.Trim()); ruleModel.CostPh = Convert.ToDouble(txtCostPh.Text.Trim()); ruleModel.CostTime = Convert.ToInt32(txtCostTime.Text.Trim()); ruleModel.LvId = (int)cmbLvId.SelectedValue; if (ruleBLL.CostRuleUpdate(ruleModel)) { MessageBox.Show("修改成功"); LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "添加了名称为‘" + txtRuleName.Text + "'的扣费规则信息"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); this.Close(); } else { MessageBox.Show("修改失败"); } })); }
public ActionResult GetPageListJson(Pagination pagination, string queryJson) { try { pagination.p_kid = "LOGID"; pagination.p_fields = "OperateTime,OperateAccount,IPAddress,Module,OperateType,ExecuteResult,ExecuteResultJson"; pagination.p_tablename = "BASE_LOG"; pagination.conditionJson = " 1=1"; var watch = CommonHelper.TimerStart(); var data = LogBLL.GetPageList(pagination, queryJson); var JsonData = new { rows = data, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); } catch (Exception ex) { string env = Config.GetValue("Environment"); string msg = env == "dev" ? ex.Message : "对不起,系统出错了。请传递正确的参数信息!"; return(Content(msg)); } }
public string GetInfo(string strBSID, string strBOID) { strBSID = strBSID + "_" + System.Reflection.MethodBase.GetCurrentMethod().Name; string errMsg = string.Empty; int reqState = 1; string result = string.Empty; try { MessageContext ctx = new MessageContext() { strBOID = strBOID, strBSID = strBSID }; MessageHandlerBase handler = MessageHandlerFactory.GetMessageHandler(strBSID, ctx); result = handler.Execute().ToString(); } catch (Exception ex) { errMsg = ex.Message; reqState = 0; } finally { LogBLL.WriteLogInterface("strBSID:" + strBSID + " strBOID:" + strBOID, result, " 获取表单数据", reqState, "BPM", "电商资金", errMsg, "WebService"); } return(result); }
private void BtnDeleteClick(object vipNoInfo) { this.Invoke(new Action(() => { if (vipNoBLL.VipNoDelete(vipNoInfo as VipNoInfo)) { MessageBox.Show("删除成功!"); LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "删除了非会员‘" + (vipNoInfo as VipNoInfo).VipName + "'的信息"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); if (IsNameSelect) { progressBar1.Visible = true; btnOK.Enabled = false; backgroundWorker2.RunWorkerAsync(); } else { progressBar1.Visible = true; btnOK.Enabled = false; backgroundWorker1.RunWorkerAsync(); } } else { MessageBox.Show("删除失败!"); } progressBar1.Visible = true; })); }
private void btnOKClick(object vipNoBorrow) { this.Invoke(new Action(() => { VipNoBorrow vipNoBorrowModel = vipNoBorrow as VipNoBorrow; if (vipNoBorrowBLL.VipNoBorrowInsert(vipNoBorrowModel, vipNoBorrowModel.RkrId) == 1) { MessageBox.Show("租车成功"); LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "为非会员‘" + txtVipNoName.Text + "'租车" + txtVNNumber.Text.ToString() + "辆"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); this.Close(); txtVNCard.Text = ""; txtVNName.Text = ""; txtVNNumber.Text = ""; txtVNPhone.Text = ""; } else if (vipNoBorrowBLL.VipNoBorrowInsert(vipNoBorrowModel, vipNoBorrowModel.RkrId) == -1) { MessageBox.Show("租车失败"); } else if (vipNoBorrowBLL.VipNoBorrowInsert(vipNoBorrowModel, vipNoBorrowModel.RkrId) == -2) { MessageBox.Show("余额不足,请先充值"); } })); }
private void btnOKClick() { this.Invoke(new Action(() => { levelModel.LvId = levelId; levelModel.LvName = txtLvName.Text.Trim(); levelModel.IsDelete = false; if (rbVip.Checked) { levelModel.IsVip = true; } else { levelModel.IsVip = false; } if (levelBLL.VipLevelUpdate(levelModel)) { MessageBox.Show("修改成功"); LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "修改了名称为‘" + txtLvName.Text + "'的会员等级信息"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); this.Close(); } else { MessageBox.Show("修改失败"); } })); }
/// <summary> /// 日志列表 /// </summary> public ActionResult GetPageListV1(Pagination pagination, SplitPage splitPage, int?CategoryId) { pagination.sidx = pagination.sort; pagination.sord = pagination.order; pagination.page = (pagination.page <= 0 ? 1 : pagination.page); pagination.rows = (pagination.rows <= 0 ? 0 : pagination.rows); List <Conditions> lisWhere = new List <Conditions>(); if (splitPage.Conditions == null) { lisWhere = new List <Conditions>(); } else { lisWhere = splitPage.Conditions.ToList <Conditions>(); } if (CategoryId.ToInt() > 0) { lisWhere.Add(new Conditions() { Key = "CategoryId", Value = CategoryId.ToStringV() }); } splitPage.Conditions = lisWhere.ToArray(); var data = LogBLL.GetPageListV(pagination, splitPage); var jsonData = new { rows = data, total = pagination.records, }; return(ToJsonResult(jsonData)); }
public int InsertCollectRank(object[] array) { int result = 0; try { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("XM_SongId", array[0]), new SqlParameter("SongName", array[1]), new SqlParameter("SingerName", array[2]), new SqlParameter("CollectName", array[3]), new SqlParameter("Tags", array[4]), new SqlParameter("CrawType", array[5]), new SqlParameter("PlayTimes", array[6]), new SqlParameter("RecommendTimes", array[7]), new SqlParameter("CollectTimes", array[8]) }; result = HelperSQL.ExecNonQuery("usp_XMSpiderCollect_Insert_CollectRank", parms); } catch (Exception ex) { LogBLL.Error("InsertCollectRank", ex); } return(result); }
public static void Backup(DateTime date) { Validate(date); string err = "Process for day: " + date.Date.ToShortDateString() + ". "; RedBloodDataContext db = new RedBloodDataContext(); if (db.PackRemainDailies.Where(r => r.Date.Value.Date == date.Date).Count() > 0) { LogBLL.LogsFailAndThrow(err + "Existing data."); } IQueryable <Pack> rows = db.Packs.Where(r => r.Status == Pack.StatusX.Product); //Insert foreach (Pack item in rows) { PackRemainDaily r = new PackRemainDaily(); r.PackID = item.ID; r.Status = item.Status; r.Date = date; r.Note = "Process on: " + DateTime.Now.ToString(); db.PackRemainDailies.InsertOnSubmit(r); } db.SubmitChanges(); LogBLL.Logs(); }
private void 除会员等级ToolStripMenuItem_Click(object sender, EventArgs e) { if (lvVipLevel.SelectedItems.Count != 1) { MessageBox.Show("请选择一行!"); } else { DialogResult result = MessageBox.Show("该操作不可逆,请问您确认删除该会员等级吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { return; } int id = Convert.ToInt32(lvVipLevel.SelectedItems[0].Tag); string lvName = lvVipLevel.SelectedItems[0].SubItems[1].Text; VipLevelInfo levelInfo = new VipLevelInfo(); levelInfo.LvId = id; levelInfo.LvName = lvName; if (levelBLL.VipLevelDelete(levelInfo as VipLevelInfo)) { MessageBox.Show("删除成功!"); LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "删除了名称为‘" + (levelInfo as VipLevelInfo).LvName + "'的会员等级"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); } else { MessageBox.Show("删除失败!"); } bg.RunWorkerAsync(); } }
/// <summary> /// Step3根据AccessToken获取微信用户详细信息 /// </summary> /// <returns></returns> private WechatUserReturnInfo GetWechatUserInfo(string WeChatCode) { string UserInfoString = string.Empty; try { Dictionary <string, object> TokenResultJson = GetAccessToken(WeChatCode); string TokenValue = TokenResultJson["access_token"].ToString(); //这是获取过来的token string OpenidValue = TokenResultJson["openid"].ToString(); //这是获取过来的openId string UserInfoURL = UrlGetUserInfo.Replace("((ACCESS_TOKEN))", TokenValue); UserInfoURL = UserInfoURL.Replace("((OPENID))", OpenidValue); UserInfoString = DataHelper.GetHttpData(UserInfoURL); return(Newtonsoft.Json.JsonConvert.DeserializeObject <WechatUserReturnInfo>(UserInfoString)); } catch (Exception ex) { LogInfo infoLog = new LogInfo(); infoLog.AddDate = DateTime.Now; infoLog.Category = "GetWechatUserInfo"; infoLog.Detail = UserInfoString + "||Ex=" + ex.Message; infoLog.Serious = 1; infoLog.UserName = string.Empty; LogBLL.Create(infoLog); return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["id"] != null && !string.IsNullOrEmpty(Request.QueryString["id"].ToString())) { LogModel log = new LogBLL().Listar(new LogModel() { Id = Convert.ToInt32(Request.QueryString["id"].ToString()) }).FirstOrDefault(); txtIP.Text = log.Ip; txtUsuario.Text = log.User; txtData.Text = log.HoraLog.Value.ToString("dd/MM/yyyy hh:mm:ss"); txtComando.Text = log.Comando; txtSite.Text = log.Site; txtProtocolo.Text = log.Protocolo; txtActualState.Text = log.ActualState; txtPreviousState.Text = log.PreviousState; txtDestino.Text = log.Destino; txtUserAgent.Text = log.UserAgent; btSalvar.Enabled = true; btSalvar.Visible = false; } } }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { switch (tabControl1.SelectedIndex) { case 0: break; case 1: break; case 2: LogBLL logBLL = new LogBLL(new LogDAL()); string strSQL = "select * from loginfo limit 20;"; //MySqlParameter[] parms = new MySqlParameter[] { }; List <object> logs = logBLL.GetObjsBySQL(strSQL, null); if (logs.Count > 0) { displayLogsInlisView(logs); } break; case 3: break; default: break; } }
public async Task <Resp <List <OutPayInfoDetails> > > GetBillingDetails(string pay_info_code) { string errMsg = string.Empty; int reqState = 1; List <OutPayInfoDetails> result = new List <OutPayInfoDetails>(); try { if (string.IsNullOrEmpty(pay_info_code)) { reqState = 0; errMsg = "付款单编号缺失!"; return(Resp.BusinessError <List <OutPayInfoDetails> >(errMsg, result)); } await Task.Run(() => { result = payInfoDetailsBll.GetBillingDetails(pay_info_code); }); return(Resp.Success(result)); } catch (Exception ex) { errMsg = ex.Message; reqState = 0; return(Resp.BusinessError <List <OutPayInfoDetails> >(errMsg, result)); } finally { string ResponseContent = reqState == 0 ? Resp.BusinessError <List <OutPayInfoDetails> >(errMsg, result).ToJson() : Resp.Success(result).ToJson(); LogBLL.WriteLogInterface(" pay_info_code:" + pay_info_code, ResponseContent, "获取资金流水明细", reqState, "共享平台", "电商资金", errMsg); } }
public List <string> Test3() { List <string> list = new List <string>(); SqlDataReader reader = null; try { reader = HelperSQL.ExecuteReader("usp_mining_Select_ProjectListRunStatus", null, CommandType.StoredProcedure); while (reader.Read()) { } return(list); } catch (Exception ex) { LogBLL.Error("GetProjectByRunStatusService 异常", ex); } finally { if (reader != null) { reader.Close(); } } return(list); }
private void 除扣费规则ToolStripMenuItem_Click(object sender, EventArgs e) { if (lvRule.SelectedItems.Count != 1) { MessageBox.Show("请选择一行!"); } else { DialogResult result = MessageBox.Show("该操作不可逆,请问您确认删除该用户吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { return; } int id = Convert.ToInt32(lvRule.SelectedItems[0].Tag); string ruleName = lvRule.SelectedItems[0].SubItems[1].Text; CostRule ruleInfo = new CostRule(); ruleInfo.CrId = id; ruleInfo.CrName = ruleName; if (ruleBLL.CostRuleDelete(ruleInfo as CostRule)) { LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "删除了名称为‘" + (ruleInfo as CostRule).CrName + "'的扣费规则"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); MessageBox.Show("删除成功!"); } else { MessageBox.Show("删除失败!"); } bg.RunWorkerAsync(); } }
private void button1_Click(object sender, EventArgs e) { LogBLL log = new LogBLL(); log.TerminoLog(); this.Dispose(); }
public ActionResult GetPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); var data = new List <LogEntity>(); string thisUser = OperatorProvider.Provider.Current().Account; if (thisUser != "System") { data = LogBLL.GetPageList(pagination, queryJson).Where(l => l.OperateAccount.Equals(thisUser)).ToList(); } else { data = LogBLL.GetPageList(pagination, queryJson).ToList(); } var JsonData = new { rows = data, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); }
public ActionResult UserLogin(string userName, string userPwd) { UserInfo info = new UserInfo(); var data = UserBLL.Login(userName, userPwd, out info); if (data == 1) { //添加日志 LogInfo log = new LogInfo(); log.User_Id = info.Id; log.UserName = info.UserName; log.Operation = "用户登录"; log.Method = "Home/Login"; log.Ip = GetClientIP(); log.Params = "userName:"******";userPwd:" + userPwd; LogBLL.AddLog(log); Session[WebConstants.UserSession] = info; //return RedirectToAction("Index", "Home"); return(new JsonResult { Data = info }); } else { return(new JsonResult { Data = data }); } }
private void btnOK_Click(object sender, EventArgs e) { if (txtUserName.Text.Trim() == "") { epMessage1.SetError(txtUserName, "请输入用户名!"); return; } else if (txtUserPWD.Text.Trim() == "") { epMessage1.SetError(txtUserPWD, "请输入密码!"); return; } userInfo = new UserInfo(); userInfo.UserName = txtUserName.Text; userInfo.UserPwd = txtUserPWD.Text; userInfo = userBLL.SelectUserByNameAndPWD(userInfo); if (userInfo != null) { this.Hide(); LogInfo logInfo = new LogInfo(); logInfo.UserId = userInfo.UserId; logInfo.LogTime = DateTime.Now; logInfo.Content = "用户" + userInfo.UserName + "登录了该系统"; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); StaticData.userLocal = userInfo; MainForm mainForm = new MainForm(); mainForm.Show(); } else { MessageBox.Show("用户名或密码错误"); } }
private void btnOKClick() { this.Invoke(new Action(() => { UserInfo user = new UserInfo(); user.UserName = txtName.Text; user.UserPwd = txtLoginPwd.Text; user.UserControlPwd = txtContorlPwd.Text; user.UserPhone = txtPhone.Text; user.UserCard = txtCard.Text; user.DpId = Convert.ToInt32(cmbDepart.SelectedValue); user.UserPhoto = image; user.UserId = userId; if (userBLL.UpdateUser(user)) { MessageBox.Show("恭喜您,修改用户成功"); LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "修改了名称为‘" + txtName.Text + "'的用户信息"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); this.Close(); } else { MessageBox.Show("很抱歉,添修改用户失败"); } })); }
protected void btn_submit(object sender, EventArgs e) { bll = new LogBLL(); //Connection.CreateCommand(""); String AppName = txt_AppName.Text; String environment = ddl_environment.SelectedValue; if (RadioButtonList1.SelectedValue == "Error") { error = new Error(); error.AppName = AppName; error.Severity = ddl_severity.SelectedIndex; errorlist = bll.ErrorBLL(error, environment); if (errorlist != null) { FormView2.DataSource = errorlist; FormView2.DataBind(); } } else { message = new Message(); message.AppName = AppName; messagelist = bll.MessageBLL(message, environment); if (messagelist != null) { // txt_AppName.Text = ((Message)messagelist[0]).Source; FormView1.DataSource = messagelist;//list FormView1.DataBind(); } } }
private void btnVNOKClick(object vipMoney) { this.BeginInvoke(new Action(() => { RechargeInfo vipMoneyTemp = vipMoney as RechargeInfo; double Integral = -1; bool result = moneyBLL.Recharge(rechargeInfo, Integral); if (result) { SelectMoneyLeft(vipMoneyTemp.VipId, false); LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "为非会员'" + cmbVipNoId.SelectedText + "'充值" + txtVipNoMoney.Text + "元"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); txtVipNoMoney.Text = ""; MessageBox.Show("充值成功!"); this.Close(); } else { MessageBox.Show("系统故障,充值失败!"); } btnVNOK.Enabled = true; })); }
public void TestLogBLL() { LogBLL bll = new LogBLL(new LogDAL()); Log log1 = new Log(0, 1, new SensorAddress("aa.bb"), "description1"); bll.Add(log1); Log log2 = new Log(0, 1, new SensorAddress("aa.bb"), "description1"); bll.Delete(log2); Log log3 = new Log(0, 1, new SensorAddress("aa.bb"), "description1"); Log log4 = new Log(0, 1, new SensorAddress("aa.bb.cc"), "description1mm"); bll.Modify(log3, log4); Log log5 = (Log)bll.GetObjById(1.ToString()); List <object> list1 = bll.GetAllObjs(); List <object> list2 = bll.GetObjsBySQL("select * from logInfo", null); int ret = bll.ExcuteSqlStr("select * from logInfo"); }
public JsonResult GetPageListJson(int?categoryid, string starttime, string endtime, string operateaccount, string ipaddress, string operatetype, string module, int rows, int page) { var from = DateTime.Parse(starttime); var to = DateTime.Parse(endtime).AddDays(1).AddSeconds(-1); var total = 0; var data = LogBLL.GetPageList(categoryid, from, to, operateaccount, ipaddress, operatetype, module, rows, page, out total); return(Json(new { rows = data, page = page, total = Math.Ceiling((decimal)total / rows) }, JsonRequestBehavior.AllowGet)); //pagination.p_kid = "LOGID"; //pagination.p_fields = "OperateTime,OperateAccount,IPAddress,Module,OperateType,ExecuteResult,ExecuteResultJson,CategoryId"; //pagination.p_tablename = "BASE_LOG t"; //pagination.conditionJson = " 1=1"; //var watch = CommonHelper.TimerStart(); //var data = LogBLL.GetPageList(pagination, queryJson); //var JsonData = new //{ // rows = data, // total = pagination.total, // page = pagination.page, // records = pagination.records, // costtime = CommonHelper.TimerEnd(watch) //}; //return Content(JsonData.ToJson()); }
public List <string> GetListSongService() { List <string> list = new List <string>(); SqlDataReader reader = null; try { string sql = "select XM_SongId from CollectSongInfo where SongName like '%?%' or Singer like '%?%'"; reader = HelperSQL.ExecuteReader(sql, null, System.Data.CommandType.Text); while (reader.Read()) { list.Add(reader["XM_SongId"].ToString()); } } catch (Exception ex) { LogBLL.Error("GetCollectSongReportListService 异常", ex); } finally { if (reader != null) { reader.Close(); } } return(list); }
private void btnOKClick() { this.Invoke(new Action(() => { departModel = new DepartInfo(); departModel.DpId = departId; departModel.DpName = txtDPName.Text; departModel.DpPlace = txtDPPlace.Text; departModel.DpPCMAC = txtDPPCMAC.Text; if (departBLL.DepartUpdate(departModel)) { MessageBox.Show("恭喜您,修改分店信息成功"); LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "添加了名称为‘" + txtDPName.Text + "'的分店信息"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); this.Close(); } else { MessageBox.Show("很抱歉,添修改分店信息失败"); } })); }
public HomeController() { this.bll = Container.Resolver <GeneDataBLL>(); //this.newsBll = new NewsBLL(); this.userBll = Container.Resolver <UserBLL>(); this.proBll = Container.Resolver <ProductBLL>(); this.logBll = Container.Resolver <LogBLL>(); }
private void btnOKClick() { this.Invoke(new Action(() => { int result = 0; VipBorrowInfo borrowInfo = new VipBorrowInfo(); borrowInfo.BbkNumber = int.Parse(txtNum.Text.Trim()); borrowInfo.BbkTime = DateTime.Now; borrowInfo.DpId = StaticData.departLocal.DpId; borrowInfo.VipId = int.Parse(txtVIPNum.Text.Trim()); borrowInfo.UserId = StaticData.userLocal.UserId; borrowInfo.Mark = txtMark.Text.Trim(); if ((int)cmbKind.SelectedValue == 1) { borrowInfo.RkrId = 1; result = vipBorrowBLL.VipBorrowInsert(borrowInfo, 1); } else if ((int)cmbKind.SelectedValue == 2) { borrowInfo.RkrId = 2; result = vipBorrowBLL.VipBorrowInsert(borrowInfo, 2); } else if ((int)cmbKind.SelectedValue == 3) { borrowInfo.RkrId = 3; result = vipBorrowBLL.VipBorrowInsert(borrowInfo, 3); } if (result == -2) { MessageBox.Show("该用户余额不足以支付起始扣费金额,请充值!"); CheckMiGo miGo = new CheckMiGo(); miGo.ShowDialog(); if (miGo.isTrue) { ReChargeWindow rechargeWinodw = new ReChargeWindow(true); rechargeWinodw.ShowDialog(); txtBalance.Text = (double.Parse(txtBalance.Text) + rechargeWinodw.chargeMoney).ToString(); } } else if (result == -1) { MessageBox.Show("系统出错,请联系管理员!"); } else if (result == 1) { MessageBox.Show("租车成功!"); btnOK.Enabled = false; LogInfo logInfo = new LogInfo(); logInfo.UserId = StaticData.userLocal.UserId; logInfo.Content = "为会员‘" + txtVipName.Text + "'租车" + txtNum.Text.ToString() + "辆"; logInfo.LogTime = DateTime.Now; logInfo.DpId = StaticData.departLocal.DpId; bool b = new LogBLL().LogInsert(logInfo); this.Close(); } })); }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { backgroundWorker1.ReportProgress(10); //这里让进度条显示进度 b = vipNoBLL.VipNoInsert(vipNoInfo); backgroundWorker1.ReportProgress(60); //这里让进度条显示进度 bool b1 = new LogBLL().LogInsert(logInfo); backgroundWorker1.ReportProgress(90);//这里让进度条显示进度 }
public void SaveDataToDB(string FullPath, string FileName, string RealFileName) { try { DataTable l_dt = null; LogBLL logbll = new LogBLL(); FormSaleBLL Formsalebll = new FormSaleBLL(); FormSampleRequestBLL formsamplerequestbll = new FormSampleRequestBLL(); int stuffuserID = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId; l_dt = this.GetDataSet(FullPath).Tables[0]; if (l_dt.Rows.Count < 1) { PageUtility.ShowModelDlg(this.Page, "文件中没有任何记录,请重新选择"); return; } List<int> FormIDs = new List<int>(); int logId = logbll.InsertImportLog(3, RealFileName, stuffuserID, 0, 0, 0); int SuccessCount = 0; int FailCount = 0; int TotalCount = l_dt.Rows.Count - 1; for (int i = 1; i < l_dt.Rows.Count; i++) { try { string l_strMaaNumber = l_dt.Rows[i][0].ToString(); string l_strSKUNo = l_dt.Rows[i][1].ToString(); string l_strPrice = l_dt.Rows[i][2].ToString(); string l_strDeliveryNo = l_dt.Rows[i][3].ToString(); string l_strQuantity = l_dt.Rows[i][4].ToString(); string l_strAmountRMB = l_dt.Rows[i][5].ToString(); string l_strDeliveryDate = l_dt.Rows[i][6].ToString(); int SkuID = 0; int FormID = 0; decimal Price = 0; decimal AmountRMB = 0; decimal Quantity = 0; DateTime DeliveryDate = DateTime.Now; if (string.IsNullOrEmpty(l_strMaaNumber) && string.IsNullOrEmpty(l_strSKUNo) && string.IsNullOrEmpty(l_strPrice) && string.IsNullOrEmpty(l_strDeliveryNo) && string.IsNullOrEmpty(l_strQuantity) && string.IsNullOrEmpty(l_strAmountRMB) && string.IsNullOrEmpty(l_strDeliveryDate)) { TotalCount--; continue; } if (string.IsNullOrEmpty(l_strMaaNumber) || string.IsNullOrEmpty(l_strSKUNo) || string.IsNullOrEmpty(l_strPrice) || string.IsNullOrEmpty(l_strDeliveryNo) || string.IsNullOrEmpty(l_strQuantity) || string.IsNullOrEmpty(l_strAmountRMB) || string.IsNullOrEmpty(l_strDeliveryDate)) { logbll.InsertImportLogDetail(logId, i, "数据有空列,导入失败!"); FailCount++; continue; } FormDS.FormDataTable l_dtForm = Formsalebll.GetDataByFormNo(l_strMaaNumber); if (l_dtForm.Rows.Count == 0) { logbll.InsertImportLogDetail(logId, i, "未找到MAA号:" + l_strMaaNumber + "的单据,导入失败!"); FailCount++; continue; } else { FormID = l_dtForm[0].FormID; } MasterData.SKUDataTable l_dtSKU = new MasterDataBLL().GetSKUBySKUNo(l_strSKUNo); if (l_dtSKU.Rows.Count == 0) { logbll.InsertImportLogDetail(logId, i, "未找到此SKU:" + l_strSKUNo + " NUMBER 下的SKU,导入失败!"); FailCount++; continue; } else { SkuID = l_dtSKU[0].SKUID; } //价格是成本价,进入系统应该是 try { Price = decimal.Round(decimal.Parse(l_strPrice) * (decimal)1.1 * (decimal)1.17, 2); } catch { logbll.InsertImportLogDetail(logId, i, "单价错误,导入失败!"); FailCount++; continue; } try { Quantity = decimal.Parse(l_strQuantity); } catch { logbll.InsertImportLogDetail(logId, i, "数量错误,导入失败!"); FailCount++; continue; } try { AmountRMB = Price * Quantity; } catch { logbll.InsertImportLogDetail(logId, i, "发货金额,导入失败!"); FailCount++; continue; } try { DeliveryDate = DateTime.Parse(l_strDeliveryDate); } catch { logbll.InsertImportLogDetail(logId, i, "日期错误,导入失败!"); FailCount++; continue; } if (string.IsNullOrEmpty(l_strDeliveryNo)) { logbll.InsertImportLogDetail(logId, i, "订单号为空,导入失败!"); FailCount++; continue; } int result = 0; FormDS.FormDeliveryGoodsDataTable l_dtFormDeliveryGoods = Formsalebll.GetDataByDeliveryNoAndSkuID(l_strDeliveryNo, SkuID, l_strMaaNumber); if (l_dtFormDeliveryGoods.Rows.Count > 0) { result = Formsalebll.UpdateFormDeliveryGoods(int.Parse(l_dtFormDeliveryGoods.Rows[0][0].ToString()), l_strDeliveryNo, DeliveryDate, Price, Quantity, AmountRMB); if (result == 0) { logbll.InsertImportLogDetail(logId, i, "数据更新失败!"); FailCount++; continue; } } else { result = Formsalebll.InsertFormDeliveryGoods(FormID, SkuID, l_strDeliveryNo, DeliveryDate, Price, Quantity, AmountRMB); if (result == 0) { logbll.InsertImportLogDetail(logId, i, "数据插入失败!"); FailCount++; continue; } } FormIDs.Add(FormID); SuccessCount++; } catch (Exception ee) { logbll.InsertImportLogDetail(logId, i, ee.Message); FailCount++; continue; } } logbll.UpdateImportLog(logId, 3, RealFileName, stuffuserID, TotalCount, SuccessCount, FailCount); this.odsApplyList.SelectParameters["queryExpression"].DefaultValue = string.Format(" LogId='{0}'", logId); gvFaillist.Visible = true; this.odsFailList.SelectParameters["logId"].DefaultValue = logId.ToString(); gvFaillist.DataBind(); string returnString = "成功导入" + TotalCount.ToString() + "条信息,其中成功" + SuccessCount.ToString() + "条,失败" + FailCount.ToString() + "条"; foreach (int formID in FormIDs) { formsamplerequestbll.UpdateFormAfterDeliveryComplete(formID, stuffuserID); } PageUtility.ShowModelDlg(this.Page, returnString); } catch (Exception e) { throw e; } }