public static Result FeedbackMsg(string userId, string handle, FeedbackModel info) { Result res = new Result(); res.ReturnValue = true; LibHandle Handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId); VerificationHandle(userId, handle, Handle, res); if (res.ReturnValue) { LibDataAccess access = new LibDataAccess(); try { string sql = string.Empty; if (!string.IsNullOrEmpty(Handle.PersonId))//待优化 { sql = string.Format("Insert into AXPFEEDBACKMSG(GUID, USERID, MESSAGETYPE, MESSAGE) VALUES({0}, {1}, {2}, {3})", LibStringBuilder.GetQuotString(Guid.NewGuid().ToString()), LibStringBuilder.GetQuotString(userId), info.MessageType, LibStringBuilder.GetQuotString(info.Message)); access.ExecuteNonQuery(sql); res.ReturnValue = true; } else { res.Message = "请重新登录!"; res.ReturnValue = false; } } catch (Exception ex) { res.ReturnValue = false; res.Message = "失败!" + ex.Message; } } return(res); }
private void CreateStoredProcedure(string path, LibDataAccess dataAccess) { if (Directory.Exists(path)) { string extendName = dataAccess.DatabaseType == LibDatabaseType.Oracle ? "*.prc" : "*.sql"; string[] files = Directory.GetFiles(path, extendName, SearchOption.AllDirectories); if (files != null) { foreach (string item in files) { string sql = string.Empty; using (FileStream fs = new FileStream(item, FileMode.Open)) { using (TextReader reader = new StreamReader(fs)) { sql = reader.ReadToEnd(); } } string name = Path.GetFileNameWithoutExtension(item); if (dataAccess.DatabaseType == LibDatabaseType.SqlServer) { dataAccess.ExecuteNonQuery(string.Format("IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID({0}) AND type in (N'P', N'PC')) DROP PROCEDURE {1} ", LibStringBuilder.GetQuotString(name), name)); dataAccess.ExecuteNonQuery(string.Format("IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID({0}) AND type in (N'V')) DROP VIEW {1} ", LibStringBuilder.GetQuotString(name), name)); } if (!string.IsNullOrEmpty(sql)) { dataAccess.ExecuteNonQuery(sql, false); } } } } }
/// <summary> /// 目录链接构造函数 /// </summary> /// <param name="forDir">是为目录创建还是为文档创建</param> /// <param name="itemId">目录或文档标识号</param> /// <param name="dbAccess">数据库访问器</param> /// <param name="isAutoCreateDirLink">是否自动创建目录链接</param> public DirLinkAddress(bool forDir, string itemId, LibDataAccess dbAccess, bool isAutoCreateDirLink) { if (dbAccess == null) { throw new Exception("数据库访问器为null!"); } this._DataAccess = dbAccess; if (string.IsNullOrEmpty(itemId)) { throw new Exception("标识号为空!"); } if (forDir) { this._DirID = itemId; } else { _DocID = itemId; //获得文档所在的目录Id,文档所在的文件夹名称,文档对应的最大修订号 _DirID = GetDirId(_DocID, out _DocDirName, out _DocMaxModifyVerId, out _DocType, out _DocName, out _IsDocLocked); } isForDir = forDir; if (isAutoCreateDirLink) { CreateDirLink(); } }
public SetPwdResult SetPassword(string handle, string oldPwd, string newPwd) { SetPwdResult result = new SetPwdResult(); LibHandle libHandle = LibHandleCache.Default.GetCurrentHandle(handle) as LibHandle; if (libHandle == null) { throw new Exception("用户句柄无效。"); } string sql = string.Format("select USERID from AXPUSER where USERID={0} and USERPASSWORD={1}", LibStringBuilder.GetQuotString(libHandle.UserId), LibStringBuilder.GetQuotString(oldPwd)); LibDataAccess dataAccess = new LibDataAccess(); string userId = LibSysUtils.ToString(dataAccess.ExecuteScalar(sql)); if (string.IsNullOrEmpty(userId)) { result.Msg = "输入的旧密码与系统不匹配。"; result.Success = false; } else { dataAccess.ExecuteNonQuery(string.Format("update AXPUSER set USERPASSWORD={2} where USERID={0} and USERPASSWORD={1}", LibStringBuilder.GetQuotString(libHandle.UserId), LibStringBuilder.GetQuotString(oldPwd), LibStringBuilder.GetQuotString(newPwd))); result.Success = true; } return(result); }
private static string SaveTaskResult(LibDataAccess dataAccess, string progId, string data) { string execTaskDataId = Guid.NewGuid().ToString(); dataAccess.ExecuteStoredProcedure("axpInsertExecTaskData", execTaskDataId, LibDateUtils.GetCurrentDateTime(), progId, data); return(execTaskDataId); }
public LibBcfBase(LibDataAccess dataAccess) { this._DataAccess = dataAccess; this.Template = RegisterTemplate(); this.DataSet = this.Template.DataSet; this.ProgId = this.Template.ProgId; }
/// <summary> /// 添加同步信息到同步信息记录表中 /// </summary> /// <param name="syncInfo"></param> /// <returns></returns> public static bool AddSyncDataRecord(SyncDataInfo syncInfo) { try { if (syncInfo == null || string.IsNullOrEmpty(syncInfo.ProgId) || string.IsNullOrEmpty(syncInfo.InternalId) || string.IsNullOrEmpty(syncInfo.UserId)) { return(false); } string sql = string.Format("insert into AXPSYNCDATAHISTORY(INFOID,PROGID,INTERNALID,BILLNO,USERID,SITEID,SYNCTIME,SYNCOP,SYNCSTATE,SYNCINFO) " + "values({0},{1},{2},{3},{4},{5},{6},{7},{8},{9})", LibStringBuilder.GetQuotString(Guid.NewGuid().ToString()), LibStringBuilder.GetQuotString(syncInfo.ProgId), LibStringBuilder.GetQuotString(syncInfo.InternalId), LibStringBuilder.GetQuotString(syncInfo.BillNo), LibStringBuilder.GetQuotString(syncInfo.UserId), LibStringBuilder.GetQuotString(syncInfo.SiteId), LibDateUtils.DateTimeToLibDateTime(syncInfo.SyncTime), (int)syncInfo.SyncOp, (int)syncInfo.SyncState, LibStringBuilder.GetQuotString(syncInfo.SyncInfo) ); LibDataAccess dataAccess = new LibDataAccess(); int count = dataAccess.ExecuteNonQuery(sql); return(count > 0); } catch (Exception exp) { LibCommUtils.AddOutput("CrossSiteCall", string.Format("error:{0}\r\nStacktrace:{1}", exp.Message, exp.StackTrace)); return(false); } }
/// <summary> /// 填充对于指定功能模块数据的同步到其他站点的历史记录 /// </summary> /// <param name="userHandle"></param> /// <param name="dt"></param> /// <param name="progId"></param> /// <param name="internalId">内码</param> public static void FillSyncDataHistory(LibHandle userHandle, DataTable dt, string progId, string internalId) { if (userHandle == null || dt == null || string.IsNullOrEmpty(progId) || ExistAxpSyncDataInfo == false || ExistLinkSiteTable == false) { return; } try { if (string.IsNullOrEmpty(internalId) == false) { string sql = string.Format("select A.*,C.PERSONNAME,D.SHORTNAME from AXPSYNCDATAHISTORY A " + " left join AXPUSER B on A.USERID = B.USERID " + " left join COMPERSON C on B.PERSONID = C.PERSONID " + " left join AXPLINKSITE D on A.SITEID = D.SITEID " + " where A.PROGID = {0} and A.INTERNALID = {1} " + " order by A.SYNCTIME desc",// 时间降序 LibStringBuilder.GetQuotString(progId), LibStringBuilder.GetQuotString(internalId)); LibDataAccess dataAccess = new LibDataAccess(); dataAccess.ExecuteDataTable(sql, dt, true, 200);//取前200条 } dt.AcceptChanges(); } catch (Exception exp) { LibCommUtils.AddOutput(@"Error\CrossSiteCall", string.Format("error:{0}\r\nStacktrace:{1}", exp.Message, exp.StackTrace)); } }
/// <summary> /// 构造跨站点调用的临时登录 /// </summary> /// <param name="userId"></param> /// <returns></returns> public LibHandle GetCrossCallHandle(string userId) { if (string.IsNullOrEmpty(userId)) { return(null); } LibHandle handle = new LibHandle(LibHandeleType.CrossSiteCall, userId, ""); SqlBuilder builder = new SqlBuilder("axp.User"); string sql = builder.GetQuerySql(0, "A.PERSONID,A.PERSONNAME,A.ROLEID,A.WALLPAPER,A.WALLPAPERSTRETCH", string.Format("A.USERID={0} And A.ISUSE=1", LibStringBuilder.GetQuotString(userId))); LibDataAccess dataAccess = new LibDataAccess(); bool exist = false; using (IDataReader reader = dataAccess.ExecuteDataReader(sql)) { if (reader.Read()) { handle.PersonId = LibSysUtils.ToString(reader[0]); handle.PersonName = LibSysUtils.ToString(reader[1]); handle.RoleId = LibSysUtils.ToString(reader[2]); exist = true; } } if (exist) { this.Set(handle.Handle, handle); return(handle); } else { return(null); } }
/// <summary> /// 获取用户可访问的站点 /// </summary> /// <param name="userHandle"></param> /// <returns></returns> public List <LinkSiteInfo> GetLinkSites(string userHandle) { // 判断userHandle存不存在 LibHandle handle = LibHandleCache.Default.GetCurrentHandle(userHandle); if (handle == null) { throw new Exception("用户句柄无效"); } List <LinkSiteInfo> linkSiteInfoList = new List <LinkSiteInfo>(); string sql = string.Format("select B.SITEID, B.SITENAME, B.SHORTNAME, B.SITEURL, B.SVCURL, B.ISSLAVE,B.ISSENDTO from AXPUSERSITE A join AXPLINKSITE B on A.SITEID = B.SITEID where A.USERID = {0}", LibStringBuilder.GetQuotString(handle.UserId)); LibDataAccess dataAccess = new LibDataAccess(); using (IDataReader reader = dataAccess.ExecuteDataReader(sql)) { while (reader.Read()) { var siteInfo = new LinkSiteInfo() { SiteId = LibSysUtils.ToString(reader["SITEID"]), SiteName = LibSysUtils.ToString(reader["SITENAME"]), ShortName = LibSysUtils.ToString(reader["SHORTNAME"]), SiteUrl = LibSysUtils.ToString(reader["SITEURL"]), SvcUrl = LibSysUtils.ToString(reader["SVCURL"]), IsSlave = LibSysUtils.ToBoolean(reader["ISSLAVE"]), IsSendTo = LibSysUtils.ToBoolean(reader["ISSENDTO"]), }; linkSiteInfoList.Add(siteInfo); } } return(linkSiteInfoList); }
public string MoveAttach(LibAttachData attachData) { LibDataAccess dataAccess = new LibDataAccess(); List <string> listSql = new List <string>(); //更新结构 UpdateAttachStruct(attachData, listSql); //更新附件记录明细 listSql.Add(string.Format("insert into AXPATTACHMENTRECORDDETAIL(BELONGTOID,ORDERID,FILENAME,PERSONID,CREATETIME) values('{0}',{1},'{2}','{3}',{4})", attachData.AttachSrc, attachData.OrderId, attachData.FileName, attachData.PersonId, LibDateUtils.GetCurrentDateTime())); LibDBTransaction trans = dataAccess.BeginTransaction(); try { dataAccess.ExecuteNonQuery(listSql); trans.Commit(); } catch { trans.Rollback(); throw; } string path = Path.Combine(EnvProvider.Default.MainPath, "AxFile", "Attachment", attachData.ProgId, attachData.AttachSrc); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string orgFilePath = Path.Combine(EnvProvider.Default.MainPath, "AxFile", "Attachment", attachData.FileName); File.Move(orgFilePath, Path.Combine(path, attachData.FileName)); return(attachData.AttachSrc); }
/// <summary> /// 验证验证码是否正确 /// </summary> /// <param name="userId"></param> /// <param name="code"></param> /// <returns></returns> private static Result VerifyCode(string userId, string code) { Result res = new Result(); try { string sql = string.Format("SELECT VERIFYCODE FROM AXPVERIFYCODE WHERE USERID={0}", LibStringBuilder.GetQuotString(userId)); LibDataAccess access = new LibDataAccess(); string realCode = LibSysUtils.ToString(access.ExecuteScalar(sql)); if (realCode == string.Empty) { res.ReturnValue = false; res.Message = "该帐号没有对应的验证码"; return(res); } if (code != null && code.Equals(realCode)) { res.ReturnValue = true; return(res); } else { res.ReturnValue = false; res.Message = "验证码错误"; return(res); } } catch (Exception ex) { res.ReturnValue = false; res.Message = "注册失败!" + ex.Message; return(res); } }
/// <summary> /// 登录 /// </summary> /// <param name="info"></param> /// <returns></returns> public static Result Login(UserInfo info) { Result res = new Result(); try { LibDataAccess access = new LibDataAccess(); SystemService server = new SystemService(); if (APPCache.CacheDic.ContainsKey(info.CodeId)) { if (string.Equals(APPCache.CacheDic[info.CodeId], info.Code, StringComparison.CurrentCultureIgnoreCase)) { LoginInfo loginInfo = server.Login(info.UserId, info.Password, false); LibHandle handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, info.UserId); if (loginInfo.PersonId == null) { res.ReturnValue = false; res.Message = "登录失败!"; } else if (handle == null) { res.ReturnValue = false; res.Message = "请重新登录!"; } else { string sql = string.Format("SELECT B.PHONENO,B.MAIL FROM AXPUSER A LEFT JOIN COMPERSON B ON B.PERSONID=A.PERSONID WHERE A.USERID={0}", LibStringBuilder.GetQuotString(info.UserId)); using (IDataReader reader = access.ExecuteDataReader(sql)) { if (reader.Read()) { //loginInfo.UserPhone = LibSysUtils.ToString(reader["PHONENO"]); loginInfo.UserEMail = LibSysUtils.ToString(reader["MAIL"]); } } loginInfo.Handle = handle.Handle; res.Info = loginInfo; res.ReturnValue = true; APPCache.RemoveAPPCache(info.CodeId); } } else { res.Message = "验证码错误!"; res.ReturnValue = false; } } else { res.Message = "验证码失效!"; res.ReturnValue = false; } } catch (Exception ex) { res.Message = ex.Message; res.ReturnValue = false; } return(res); }
/// <summary> /// 登录成功后删除验证码 /// </summary> /// <param name="userId"></param> private static void DeleteCode(string userId) { string sql = string.Format("DELETE FROM AXPVERIFYCODE WHERE USERID={0}", LibStringBuilder.GetQuotString(userId)); LibDataAccess access = new LibDataAccess(); access.ExecuteNonQuery(sql); }
public void RemoveAttach(string attachSrc, int orderId, string personId) { LibDataAccess dataAccess = new LibDataAccess(); dataAccess.ExecuteNonQuery(string.Format("insert into AXPATTACHMENTRECORDDETAIL(BELONGTOID,ORDERID,FILENAME,PERSONID,CREATETIME) values('{0}',{1},'{2}','{3}',{4})", attachSrc, orderId, string.Empty, personId, LibDateUtils.GetCurrentDateTime())); }
public static void DelBcf(string progId, List <string> list, LibDataAccess dataAccess, LibManagerMessage manager = null) { if (manager == null) { manager = new LibManagerMessage(); } try { foreach (var item in list) { if (!string.IsNullOrEmpty(item)) { LibBcfData bcfData = (LibBcfData)LibBcfSystem.Default.GetBcfInstance(progId); bcfData.DataAccess = dataAccess; DataSet ds = bcfData.BrowseTo(new object[] { item }); if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0) { continue; } ds.Clear(); bcfData.Delete(new object[] { item }); } } } catch (Exception ex) { manager.AddMessage(new LibMessage() { MessageKind = LibMessageKind.Error, Message = string.Format("系统错误:{0}", ex.Message) }); } }
public List <LibBusinessTask> InitTempTask() { List <LibBusinessTask> list = new List <LibBusinessTask>(); LibDataAccess dataAccess = new LibDataAccess(); using (IDataReader reader = dataAccess.ExecuteDataReader("select TASKID,PROGID,BUSINESSTASKID,EXECDATE,EXECTIME,EXECCONDITION,INTERNALID from AXPBUSINESSTEMPTASK", false)) { while (reader.Read()) { LibBusinessTask task = new LibBusinessTask() { TaskType = LibTaskType.TempTask, TaskId = LibSysUtils.ToString(reader["TASKID"]), ProgId = LibSysUtils.ToString(reader["PROGID"]), BusinessTaskId = LibSysUtils.ToString(reader["BUSINESSTASKID"]), ExecDate = LibSysUtils.ToInt32(reader["EXECDATE"]), ExecCondition = LibSysUtils.ToString(reader["EXECCONDITION"]), InternalId = LibSysUtils.ToString(reader["INTERNALID"]) }; task.ExecTime.Add(LibSysUtils.ToInt32(reader["EXECTIME"])); list.Add(task); } } return(list); }
public CalendarData(string calendarId) { if (string.IsNullOrEmpty(calendarId)) { return; } LibDataAccess dataAccess = new LibDataAccess(); SqlBuilder sqlBuilder = new SqlBuilder("com.Calendar"); string sql = sqlBuilder.GetQuerySql(1, "B.YEAR,B.MONTH,B.WORKMARK", string.Format("B.CALENDARID={0}", LibStringBuilder.GetQuotString(calendarId))); using (IDataReader reader = dataAccess.ExecuteDataReader(sql)) { while (reader.Read()) { int year = LibSysUtils.ToInt32(reader[1]); if (!WorkDayList.ContainsKey(year)) { WorkDayList.Add(year, new int[12]); } int[] items = WorkDayList[year]; int month = LibSysUtils.ToInt32(reader["MONTH"]); items[month - 1] = LibSysUtils.ToInt32(reader["WORKMARK"]); } } }
public string getSupplIer(string supplyUserId) { string supplierId = string.Empty; LibDataAccess dataAccess = new LibDataAccess(); string sql = string.Format("SELECT SUPPLIERID FROM COMPERSON WHERE PERSONID = '{0}'", supplyUserId); supplierId = LibSysUtils.ToString(dataAccess.ExecuteScalar(sql)); return(supplierId); }
public static Result ExceptionBill(string BillNo, string userId, string handle) { Result res = new Result(); res.ReturnValue = true; LibHandle Handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId); Service.VerificationHandle(userId, handle, Handle, res); if (res.ReturnValue) { LibDataAccess access = new LibDataAccess(); try { string sql = string.Empty; if (!string.IsNullOrEmpty(Handle.PersonId)) { sql = string.Format(@"SELECT A.BILLNO, A.PLANENDTIME, A.ABNORMALREASONID, B.ABNORMALREASONNAME, B.ABNORMALREASONTYPEID, C.ABNORMALREASONTYPENAME, A.PERSONID, D.PERSONNAME, A.DEALWITHPERSONID, E.PERSONNAME AS DEALWITHPERSONNAME, E.DEPTID AS DEALWITHDEPTID, F.DEPTNAME AS DEALWITHDEPTNAME, A.SOLUTION, A.DEALWITHSTATE FROM COMABNORMALTRACE A LEFT JOIN COMABNORMALREASON B ON B.ABNORMALREASONID=A.ABNORMALREASONID LEFT JOIN COMABNORMALREASONTYPE C ON C.ABNORMALREASONTYPEID=B.ABNORMALREASONTYPEID LEFT JOIN COMPERSON D ON D.PERSONID=A.PERSONID LEFT JOIN COMPERSON E ON E.PERSONID=A.DEALWITHPERSONID LEFT JOIN COMDEPT F ON F.DEPTID =E.DEPTID WHERE A.FROMBILLNO={0}", BillNo); res.Info = access.ExecuteDataSet(sql); res.ReturnValue = true; res.Message = "成功!"; } else { res.ReturnValue = false; res.Message = "请重新登录!"; } } catch (Exception ex) { res.ReturnValue = false; res.Message = "查询失败!" + ex.Message; } } return(res); }
public static void SendNews(LibSysNews news, bool needUserInfo = true) { LibDataAccess dataAccess = new LibDataAccess(); List <string> userInfo = needUserInfo ? GetUserInfo(dataAccess, news.UserList) : news.UserList; string execTaskDataId = SaveTaskResult(dataAccess, news.ProgId, news.Data); if (news.UserList.Count > 0) { SaveSysNews(dataAccess, news.Title, news.Content, news.PersonId, execTaskDataId, userInfo); } }
public void SetWallpaper(string handle, string wallpaper, bool stretch) { LibHandle libHandle = LibHandleCache.Default.GetCurrentHandle(handle) as LibHandle; if (libHandle == null) { throw new Exception("用户句柄无效。"); } LibDataAccess dataAccess = new LibDataAccess(); dataAccess.ExecuteNonQuery(string.Format("update AXPUSER set WALLPAPER={0},WALLPAPERSTRETCH={1} where USERID={2}", LibStringBuilder.GetQuotString(wallpaper), stretch ? 1 : 0, LibStringBuilder.GetQuotString(libHandle.UserId))); }
private ILibDbSchema GetSchemaHelper(LibDataAccess dataAccess) { LibDatabaseType databaseType = dataAccess.DatabaseType; if (LibDatabaseType.Oracle == databaseType) { return(new LibOracleDbSchema()); } else { return(new LibSqlServerDbSchema()); } }
public void RemoveUserPicture(string progId, string internalId, string fileName) { string path = Path.Combine(EnvProvider.Default.RuningPath, "UserPicture", progId, internalId, fileName); if (File.Exists(path)) { File.Delete(path); LibDataAccess dataAccess = new LibDataAccess(); LibSqlModel model = LibSqlModelCache.Default.GetSqlModel(progId); dataAccess.ExecuteNonQuery(string.Format("update {0} set IMGSRC='' where INTERNALID={1}", model.Tables[0].TableName, LibStringBuilder.GetQuotString(internalId)), false); } }
public string Register(RegisterInfo info) { string error = string.Empty; LibDataAccess dataAccess = new LibDataAccess(); string userId = LibSysUtils.ToString(dataAccess.ExecuteScalar(string.Format("select USERID from AXPUSER where USERID={0}", LibStringBuilder.GetQuotString(info.inputId)))); if (string.IsNullOrEmpty(userId)) { string personId = LibSysUtils.ToString(dataAccess.ExecuteScalar(string.Format("select PERSONID from COMPERSON where PERSONNAME={0} and DEPTID={1}", LibStringBuilder.GetQuotString(info.inputName), LibStringBuilder.GetQuotString(info.inputDept)))); //如果遇到同部门同名的情况。建议客户手动创建人员主数据。 if (string.IsNullOrEmpty(personId)) { LibBcfData bcfData = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("com.Person"); DataSet dataSet = bcfData.AddNew(null); DataRow masterRow = dataSet.Tables[0].Rows[0]; masterRow.BeginEdit(); try { if (string.IsNullOrEmpty(LibSysUtils.ToString(masterRow["PERSONID"]))) { masterRow["PERSONID"] = personId = LibCommUtils.GetInternalId().ToString(); } masterRow["PERSONNAME"] = info.inputName; masterRow["GENDER"] = info.gender; masterRow["DEPTID"] = info.inputDept; masterRow["MAIL"] = info.inputEmail; masterRow["PHONENO"] = info.inputPhone; } finally { masterRow.EndEdit(); } dataSet = bcfData.InnerSave(BillAction.AddNew, new object[] { personId }, dataSet); personId = LibSysUtils.ToString(dataSet.Tables[0].Rows[0]["PERSONID"]); } if (!string.IsNullOrEmpty(personId)) { string sql = string.Format("insert into AXPUSER(USERID,USERPASSWORD,PERSONID,ISUSE) values({0},{1},{2},0)", LibStringBuilder.GetQuotString(info.inputId), LibStringBuilder.GetQuotString(info.inputPassword1), LibStringBuilder.GetQuotString(personId)); dataAccess.ExecuteNonQuery(sql); } } else { error = "账号已注册"; } return(error); }
private static void Main() { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); using ApplicationDbContext dataAccess = LibDataAccess.CreateDataAccess(Config); IImportData infoImport; infoImport = new ACCFTTImport(dataAccess); infoImport.ExecuteImport(); infoImport = new ReceiptInfoImportBANK(dataAccess); infoImport.ExecuteImport(); infoImport = new ReceiptInfoImportPOST(dataAccess); infoImport.ExecuteImport(); infoImport = new ReceiptInfoImportMARKET(dataAccess); infoImport.ExecuteImport(); //infoImport = new ReceiptInfoImportMARKETSPI(dataAccess); infoImport.ExecuteImport(); //infoImport = new ReceiptInfoImportFARM(dataAccess); infoImport.ExecuteImport(); infoImport = new RemitInfoImport(dataAccess); infoImport.ExecuteImport(); }
/// <summary> /// 获取用户可访问的下级站点代码列表 /// </summary> /// <param name="userId"></param> /// <returns>站点代码与站点信息的字典</returns> public static Dictionary <string, LinkSiteInfo> GetCanLoginSlaveSites(string userId) { if (string.IsNullOrEmpty(userId)) { return(null); } Dictionary <string, LinkSiteInfo> siteIds = new Dictionary <string, LinkSiteInfo>(); try { if (ExistLinkSiteTable == false || ExistUserLinkSiteTable == false) { return(null); } string sql = string.Format("select distinct B.* from AXPUSERSITE A " + " left join AXPLINKSITE B on A.SITEID = B.SITEID" + " where A.USERID = {0} and ISSLAVE = 1", LibStringBuilder.GetQuotString(userId)); LibDataAccess dataAccess = new LibDataAccess(); string name = string.Empty; string id = string.Empty; using (IDataReader reader = dataAccess.ExecuteDataReader(sql)) { while (reader.Read()) { id = LibSysUtils.ToString(reader["SITEID"]); name = LibSysUtils.ToString(reader["SHORTNAME"]); if (string.IsNullOrEmpty(id) == false) { siteIds[id] = new LinkSiteInfo() { SiteId = id, SiteName = LibSysUtils.ToString(reader["SITENAME"]), ShortName = LibSysUtils.ToString(reader["SHORTNAME"]), SiteUrl = LibSysUtils.ToString(reader["SITEURL"]), SvcUrl = LibSysUtils.ToString(reader["SVCURL"]), IsSlave = LibSysUtils.ToBoolean(reader["ISSLAVE"]), IsSendTo = LibSysUtils.ToBoolean(reader["ISSENDTO"]), }; } } } } catch { //to do log } return(siteIds); }
public LoginInfo Login1(string userId, string password, bool quitOther = false) { LoginInfo loginInfo = new LoginInfo(); SqlBuilder builder = new SqlBuilder("axp.User"); string sql = builder.GetQuerySql(0, "A.Id,A.Name,A.UserImage", string.Format("A.Id={0} And A.Password={1} And A.ISUSE=1", LibStringBuilder.GetQuotString(userId), LibStringBuilder.GetQuotString(password))); LibDataAccess dataAccess = new LibDataAccess(); string roleId = string.Empty; bool exists = false; using (IDataReader reader = dataAccess.ExecuteDataReader(sql)) { if (reader.Read()) { loginInfo.Id = LibSysUtils.ToString(reader[0]); loginInfo.Name = LibSysUtils.ToString(reader[1]); loginInfo.UserImage = LibSysUtils.ToString(reader[2]); exists = true; } } if (exists) { LibHandle handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId); if (handle != null) { //LibHandleCache.Default.RemoveHandle(handle.Handle); } if (!loginInfo.IsUsed) { string loginIp = string.Empty; //Zhangkj20161219 增加LoginIp System.ServiceModel.OperationContext context = System.ServiceModel.OperationContext.Current; //对于非WCF的访问context为null if (context != null) { System.ServiceModel.Channels.MessageProperties properties = context.IncomingMessageProperties; System.ServiceModel.Channels.RemoteEndpointMessageProperty endpoint = properties[System.ServiceModel.Channels.RemoteEndpointMessageProperty.Name] as System.ServiceModel.Channels.RemoteEndpointMessageProperty; loginIp = endpoint.Address + ":" + endpoint.Port.ToString(); } //创建新的Handle handle = LibHandleCache.Default.GetHandle(string.Empty, LibHandeleType.PC, userId, loginInfo.PersonId, loginInfo.PersonName, roleId, loginIp); if (handle != null) { loginInfo.Handle = handle.Handle; } } } return(loginInfo); }
public static Result GenerateCode(string userId, string phoneNo) { Result res = new Result(); try { // 生成四位数的验证码 Random r = new Random(); int i = (int)(r.NextDouble() * 10000); string code = i.ToString().PadLeft(4, '0'); // 查看是否存在该帐号对应的验证码 LibDataAccess access = new LibDataAccess(); string sql = string.Format("SELECT count(*) FROM AXPVERIFYCODE WHERE USERID = {0}", LibStringBuilder.GetQuotString(userId)); int count = LibSysUtils.ToInt32(access.ExecuteScalar(sql)); // 生成或者更新验证码 if (count == 0) { sql = string.Format("INSERT INTO AXPVERIFYCODE(USERID, VERIFYCODE, TIME) VALUES({0}, {1}, {2})", LibStringBuilder.GetQuotString(userId), LibStringBuilder.GetQuotString(code), LibDateUtils.GetCurrentDateTime()); } else if (count == 1) { sql = string.Format("UPDATE AXPVERIFYCODE SET VERIFYCODE={0}, TIME={1} WHERE USERID={2}", LibStringBuilder.GetQuotString(code), LibDateUtils.GetCurrentDateTime(), LibStringBuilder.GetQuotString(userId)); } access.ExecuteNonQuery(sql); // 发送短信 SendSMSParam sendSMSParam = new SendSMSParam(); sendSMSParam.Message = "验证码为:" + code; sendSMSParam.PhoneList.Add(phoneNo); LibSMSHelper.SendMsg(sendSMSParam); res.ReturnValue = true; res.Message = "成功!"; } catch (Exception ex) { res.ReturnValue = false; res.Message = "失败!" + ex.Message; } return(res); }
private static Result SetComPersonInfo(string personId, string value, SetPersonInfoState state) { Result res = new Result(); string columnName = string.Empty; switch (state) { case SetPersonInfoState.phoneNo: columnName = "PHONENO"; break; case SetPersonInfoState.Cornet: columnName = "CORNET"; break; case SetPersonInfoState.PersonName: columnName = "PERSONNAME"; break; case SetPersonInfoState.Email: columnName = "MAIL"; break; } try { string sql = string.Format("UPDATE COMPERSON SET {0}={1} WHERE PERSONID={2}", columnName, LibStringBuilder.GetQuotString(value), LibStringBuilder.GetQuotString(personId)); LibDataAccess dataAccess = new LibDataAccess(); int count = -1; count = dataAccess.ExecuteNonQuery(sql); if (count > 0) { res.ReturnValue = true; } else { res.ReturnValue = false; res.Message = "设置失败!"; } } catch (Exception ex) { res.ReturnValue = false; res.Message = ex.Message; } return(res); }