public void Load() { CfgVersion ver = CfgVersionBll.GetFirstCfg(); if (ver != null) { _verInDb = ver.Version.Value; } lstOrgsByDb = OrgBll.GetAllOrgInfo(); lstGroupsByDb = GroupBll.GetAllGroupInfo(); lstProjectsByDb = ProjectBll.GetAllProject(); lstCardsByDb = CardWithCommDevBll.GetAllDevList(); MakeMemCard(_loadFlag); MakeMemProject(_loadFlag); MakeMemGroup(_loadFlag); MakeMemOrg(_loadFlag); MakeMemCommByClientSn(_loadFlag); MakeCardRef(); MakeProjectRef(); MakeGroupRef(); MakeOrgRef(); lstOrgsByDb.Clear(); lstGroupsByDb.Clear(); lstProjectsByDb.Clear(); lstCardsByDb.Clear(); }
private void InsertProject(DataTable dtProject) { foreach (DataRow row in dtProject.Rows) { string strId = row["Index"].ToString(); string strName = row["Name"].ToString(); string strManager = row["ManagerName"].ToString(); string strManagerTel = row["ManagerTel"].ToString(); string strAddress = row["Address"].ToString(); string strRefGroupName = row["RefGroupName"].ToString(); if (GroupBll.IsNameExist(strName)) { continue; } GlareSysEfDbAndModels.ProjectInfo project = new GlareSysEfDbAndModels.ProjectInfo() { Address = strAddress, CreateDt = DateTime.Now, Id = 0, IsDel = 0, UpdateDt = DateTime.Now, GroupId = DataLoader.GetProjectIDByProjectName(strRefGroupName), ManagerName = strManager, ManagerTel = strManagerTel, OrgId = DataLoader.GetOrgIDByProjectName(strRefGroupName), ProjectName = strName }; string strError; ProjectBll.AddAProject(ref project, out strError); } }
ImageList faceList; //用户头像列表 public AddFriendsForm(User user) { InitializeComponent(); currUser = user; friendBll = new FriendBll(); groupBll = new GroupBll(); }
public ViewResult Details(int id) { GroupBll bll = new GroupBll(); Group group = bll.Gets(x => x.Id == id).SingleOrDefault(); return(View(group)); }
public ActionResult my(FormCollection fc) { if (UserInfo == null) { return(RedirectToAction("login", "member")); } var model = new tblcompany(); model.Area = fc["Area"]; model.Contacts = fc["Contacts"]; model.Moblie = fc["Moblie"]; model.Name = fc["Name"]; model.userid = UserInfo.userid; GroupBll bll = new GroupBll(); int res = bll.UpdateCompany(model); if (res < 0) { model.Status = -999; } else { model.Status = -888; } return(View(model)); }
private void InsertProject(DataTable dtProject) { foreach (DataRow row in dtProject.Rows) { string strId = row["Index"].ToString(); string strName = row["Name"].ToString(); string strManager = row["ManagerName"].ToString(); string strManagerTel = row["ManagerTel"].ToString(); string strAddress = row["Address"].ToString(); string strRefOrg = row["RefGroupName"].ToString(); if (GroupBll.IsNameExist(strName)) { continue; } GlareSysEfDbAndModels.OrgInfo org = new GlareSysEfDbAndModels.OrgInfo() { Address = strAddress, CreateDt = DateTime.Now, Id = 0, IsDel = 0, ManageName = strManager, ManageTel = strManagerTel, Name = strName, UpdateDt = DateTime.Now }; string strError; OrgBll.AddAOrg(ref org, out strError); } MemCfgInfo.MemDbMgr.Get().Load(); }
public ActionResult import(FormCollection fc, HttpPostedFileBase file) { if (file == null) { GroupBll bll = new GroupBll(); var list = bll.GetMatch("1"); StringBuilder sbt = new StringBuilder(); for (int i = 0; i < list.Count; i++) { if (list[i].Match_id == fc["match"]) { sbt.AppendFormat("<option value='{0}' selected>{1}</option>", list[i].Match_id, list[i].Match_name); } else { sbt.AppendFormat("<option value='{0}'>{1}</option>", list[i].Match_id, list[i].Match_name); } } ViewBag.match = sbt.ToString(); ViewBag.flag = "-1"; return(View()); } else { string filename = string.Format("{0}{1}", Guid.NewGuid().ToString(), System.IO.Path.GetExtension(file.FileName)); file.SaveAs(System.IO.Path.Combine(Server.MapPath("~/upload/file"), filename)); return(RedirectToAction("confirm", new { matchid = fc["match"], fid = filename })); } }
private void InsertGroup(DataTable dtGroup) { foreach (DataRow row in dtGroup.Rows) { string strId = row["Index"].ToString(); string strName = row["Name"].ToString(); string strManager = row["ManagerName"].ToString(); string strManagerTel = row["ManagerTel"].ToString(); string strAddress = row["Address"].ToString(); string strRefOrg = row["RefOrgName"].ToString(); if (GroupBll.IsNameExist(strName)) { continue; } GlareSysEfDbAndModels.GroupInfo group = new GlareSysEfDbAndModels.GroupInfo() { CreateDt = DateTime.Now, Id = 0, IsDel = 0, ManageName = strManager, ManageTel = strManagerTel, UpdateDt = DateTime.Now, GroupAddress = strAddress, GroupName = strName, OrgId = DataLoader.GetOrgIDByOrgName(strRefOrg) }; string strError; GroupBll.AddAGroup(ref group, out strError); } }
// GET: Group public ActionResult Index() { GroupBll bll = new GroupBll(); List <Group> list = bll.GetAll().ToList(); return(View(list)); }
public ActionResult detail(string id) { ViewBag.id = id; GroupBll bll = new GroupBll(); var m = bll.GetMatchById(id); return(View(m)); }
public ActionResult Edit(long id = 0) { if (id == 0) { return(View(new Group())); } var info = GroupBll.GetById(id); return(View(info)); }
public ActionResult Delete(int id, Group model) { var group = new GroupBll().Get(x => x.Id == id); if (group != null) { new GroupBll().Delete(group); } return(RedirectToAction("Index")); }
private int groupID = 0; //当前默认组号 public ChooseGroup(User currUser, User user, IList <Model.Group> groupList) { InitializeComponent(); this.currUser = currUser; this.groupList = groupList; this.user = user; this.groupMemberBll = new GroupMemberBll(); this.groupBll = new GroupBll(); this.friendBll = new FriendBll(); }
// // GET: /group/ public ActionResult my() { if (UserInfo == null) { return(RedirectToAction("login", "member")); } GroupBll bll = new GroupBll(); return(View(bll.GetCompanyByUserid(UserInfo.userid))); }
public ActionResult matchlist() { if (UserInfo == null) { return(RedirectToAction("login", "member")); } GroupBll bll = new GroupBll(); return(View(bll.GetMymatch(UserInfo.userid))); }
private P2pServerSocket p2pServerSocket; //p2p服务端socket线程 #endregion public FriendListForm() { InitializeComponent(); userBll = new UserBll(); session = SessionBll.GetInstance(); groupBll = new GroupBll(); friendBll = new FriendBll(); user = session.User; string ip = AppUtil.GetLocalIp(); p2pFormList = new Dictionary <int, P2pChatForm>(); p2pSocketList = new Dictionary <int, TcpClient>(); p2pServerSocket = new P2pServerSocket(); p2pServerSocket.Start();//开启监听 }
public ActionResult Delete(long id) { var apiResult = new APIResult(); try { GroupBll.DeleteById(id); } catch (Exception ex) { apiResult.Ret = -1; apiResult.Msg = ex.Message; if (!(ex is OperationExceptionFacade)) { LogFactory.GetLogger().Log(LogLevel.Error, ex); } } return(Json(apiResult)); }
public JsonResult Edit(Group model) { var apiResult = new APIResult(); try { GroupBll.AddOrUpdate(model, (UserEntity)UserContext.CurrentUser); } catch (Exception ex) { apiResult.Ret = -1; apiResult.Msg = ex.Message; if (!(ex is OperationExceptionFacade)) { LogFactory.GetLogger().Log(LogLevel.Error, ex); } } return(Json(apiResult)); }
public ActionResult import() { GroupBll bll = new GroupBll(); var list = bll.GetMatch("1"); StringBuilder sbt = new StringBuilder(); for (int i = 0; i < list.Count; i++) { if (i == 0) { sbt.AppendFormat("<option value='{0}' selected>{1}</option>", list[i].Match_id, list[i].Match_name); } else { sbt.AppendFormat("<option value='{0}'>{1}</option>", list[i].Match_id, list[i].Match_name); } } ViewBag.match = sbt.ToString(); ViewBag.flag = "0"; return(View()); }
public ActionResult importsuccess(string m, string s) { if (UserInfo == null) { return(RedirectToAction("login", "member")); } GroupBll bll = new GroupBll(); var com = bll.GetCompanyByUserid(UserInfo.userid); if (com != null) { ViewBag.com = com.Name; } else { ViewBag.com = ""; } ViewBag.match = m; ViewBag.msg = s; return(View()); }
private void buttonOk_Click(object sender, EventArgs e) { GroupInfo mod = new GroupInfo() { CreateDt = DateTime.Now, GroupAddress = "", GroupName = textBoxName.Text, Id = 0, IsDel = 0, ManageName = textBoxManagerName.Text, ManageTel = textBoxTel.Text, OrgId = (int)comboBoxOrg.SelectedValue, UpdateDt = DateTime.Now }; string strMsg; if (!GroupBll.AddAGroup(ref mod, out strMsg)) { DialogResult = DialogResult.None; MessageBox.Show(strMsg); } }
public string AddGroup(string strParams) { string strError; RequestModelString reqinfo = ServerHlper.GetRequestModelString(System.Reflection.MethodBase.GetCurrentMethod().Name, strParams, out strError); if (reqinfo == null) { return(strError); } GroupInfo mod = JsonStrObjConver.JsonStr2Obj(reqinfo.Info, typeof(GroupInfo)) as GroupInfo; if (mod == null) { return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError)); } bool bResult = GroupBll.AddAGroup(ref mod, out strError); if (!bResult) { return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.LoginNameOrPassword)); } // 成功返回成功标志及新增加的ID JsonResutlModelString result = new JsonResutlModelString() { ErrorDesc = "success", Info = mod.Id.ToString(), Status = true, StatusInt = 1 }; return(JsonStrObjConver.Obj2JsonStr(result, typeof(JsonResutlModelString))); }
public ActionResult Modify(GlareSysEfDbAndModels.GroupInfo subject) { ResultHelper objResult = null; try { using (LedDb db = new LedDb()) { if (ModelState.IsValid) { GroupInfo aSubject = db.GroupInfo.Where(p => p.Id == subject.Id).FirstOrDefault(); aSubject.GroupName = subject.GroupName; aSubject.GroupAddress = subject.GroupAddress; aSubject.ManageName = subject.ManageName; aSubject.ManageTel = subject.ManageTel; aSubject.OrgId = subject.OrgId; aSubject.UpdateDt = DateTime.Now; string strMsg = string.Empty; bool b = GroupBll.UpdateProejct(ref subject, out strMsg); if (b) { objResult = new ResultHelper() { Status = true, Ret = 0, Obj = subject, Msg = strMsg, Desc = strMsg }; } else { objResult = new ResultHelper() { Desc = strMsg, Msg = strMsg, Obj = null, Ret = -1, Status = false }; } //if (db.SaveChanges() > 0) //{ // objResult = new ResultHelper() // { // Status = true, // Ret = 0, // Obj = subject, // Msg = "Edit Success!", // Desc = "Edit Success!" // }; //} //else //{ // objResult = new ResultHelper() // { // Desc = "Edit Faile,please try again.", // Msg = "Edit Faile,please try again.", // Obj = null, // Ret = -1, // Status = false // }; //} } else { objResult = new ResultHelper() { Desc = " Faile,please try again", Msg = " Faile,please try again", Obj = null, Ret = -1, Status = false }; } } } catch (Exception ex) { objResult = new ResultHelper() { Desc = ex.Message, Msg = ex.Message, Obj = null, Ret = -1, Status = false }; } return(Json(objResult)); }
public ActionResult Delete(string GroupIds) { ResultHelper objResult = null; try { using (LedDb db = new LedDb()) { if (ModelState.IsValid) { string[] Id = GroupIds.Split(','); string strMsg = string.Empty; for (int i = 0; i < Id.Length; i++) { GroupBll.DeleteAGroup(int.Parse(Id[i]), out strMsg); } objResult = new ResultHelper() { Status = true, Ret = 0, Obj = GroupIds, Msg = strMsg, Desc = strMsg }; //StringBuilder strSql = new StringBuilder(); //strSql.AppendFormat(@"UPDATE GroupInfo SET IsDel = 1 WHERE Id IN ({0})", GroupIds); //if (db.Database.ExecuteSqlCommand(strSql.ToString()) > 0) //{ // objResult = new ResultHelper() // { // Status = true, // Ret = 0, // Obj = GroupIds, // Msg = "Delete Success!", // Desc = "Delete Success!" // }; //} //else //{ // objResult = new ResultHelper() // { // Desc = "Delete Faile,please try again.", // Msg = "Delete Faile,please try again.", // Obj = null, // Ret = -1, // Status = false // }; //} } else { objResult = new ResultHelper() { Desc = " Faile,please try again", Msg = " Faile,please try again", Obj = null, Ret = -1, Status = false }; } } } catch (Exception ex) { objResult = new ResultHelper() { Desc = ex.Message, Msg = ex.Message, Obj = null, Ret = -1, Status = false }; } return(Json(objResult)); }
/// <summary> /// 导入确认 /// </summary> /// <param name="matchid"></param> /// <param name="fid"></param> /// <returns></returns> public ActionResult confirm(string matchid, string fid) { try { ViewBag.error = "0"; ViewBag.matchid = matchid; ViewBag.fid = fid; List <tblmatchentity> lstMatchusers = new List <tblmatchentity>(); DataTable data = NpoiHelper.XlSToDataTable(System.IO.Path.Combine(Server.MapPath("~/upload/file"), fid), "TTBM", 0); if (data == null || data.Rows.Count < 1) { return(View(lstMatchusers)); } GroupBll bll = new GroupBll(); tblmatch match = bll.GetMatchById(matchid); ViewBag.matchname = HttpUtility.HtmlEncode(match.Match_name); StringBuilder sbtError = new StringBuilder(); int sn = 0; string lineid = ""; string teamno = ""; string teamname = ""; string company = ""; int year = 0; foreach (DataRow row in data.Rows) { sbtError.Clear(); year = 0; if (string.IsNullOrEmpty(row["队员姓名"].ToString().Trim())) { continue; } //记录序号,以标记团队 if (!string.IsNullOrEmpty(row["序号"].ToString().Trim())) { sn = int.Parse(row["序号"].ToString().Trim()); } if (!string.IsNullOrEmpty(row["路线名称"].ToString().Trim())) { lineid = row["路线名称"].ToString().Trim(); var d = bll.GetLineByName(lineid); if (d == null) { sbtError.AppendFormat("[路线名称:{0}]不存在;", lineid); } } if (!string.IsNullOrEmpty(row["队列号"].ToString().Trim())) { teamno = row["队列号"].ToString().Trim(); } if (!string.IsNullOrEmpty(row["队名(6个字符以内)"].ToString().Trim())) { teamname = row["队名(6个字符以内)"].ToString().Trim(); } if (!string.IsNullOrEmpty(row["单位名称"].ToString().Trim())) { company = row["单位名称"].ToString().Trim(); } if (string.IsNullOrEmpty(row["性别"].ToString().Trim())) { sbtError.Append("[性别]不能为空;"); } if (string.IsNullOrEmpty(row["身份证/护照"].ToString().Trim())) { sbtError.Append("[身份证/护照]不能为空;"); } else { if (!System.Text.RegularExpressions.Regex.IsMatch(row["身份证/护照"].ToString().Trim(), @"^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$")) { sbtError.Append("[身份证/护照]格式错误;"); } } if (!System.Text.RegularExpressions.Regex.IsMatch(row["手机号码"].ToString().Trim(), @"^[1]+[0-9]+\d{9}")) { sbtError.AppendFormat("[手机号码:{0}]格式错误;", row["手机号码"]); } if (!int.TryParse(row["年龄"].ToString().Trim(), out year)) { sbtError.AppendFormat("[年龄:{0}]是否输入及正确;", row["年龄"]); } if (sbtError.Length > 0) { ViewBag.error = "-1"; } tblmatchentity muser = new tblmatchentity(); muser.Pnov = sn.ToString(); muser.Teamname = teamname; muser.Cardno = row["身份证/护照"].ToString().Trim(); muser.Cardtype = "1"; muser.Createtime = DateTime.Now;//.ToString("yyyy-MM-dd"); //muser.Leader = row["队员编号"].ToString().Trim() == "队长" ? 1 : 0; muser.Match_Id = ""; muser.Matchuserid = Guid.NewGuid().ToString(); muser.Mobile = row["手机号码"].ToString().Trim(); muser.Nickname = row["队员姓名"].ToString().Trim(); muser.Lineno = lineid; muser.LeaderM = row["队员编号"].ToString().Trim() == "队长" ? "是" : ""; muser.Sexy = row["性别"].ToString().Trim() == "男" ? 1 : 0; muser.Age = year; muser.Mono = row["是否健康"].ToString().Trim(); muser.Content = HttpUtility.HtmlEncode(sbtError.ToString()); lstMatchusers.Add(muser); } return(View(lstMatchusers)); } catch (Exception ex) { ILog log = LogManager.GetLogger(this.GetType()); log.Error(ex); ViewBag.error = "-2"; return(View()); } }
public ActionResult Update(int id) { Group model = new GroupBll().Get(x => x.Id == id); return(View(model)); }
public ActionResult Add(GlareSysEfDbAndModels.GroupInfo subject) { ResultHelper objResult = null; try { using (LedDb db = new LedDb()) { if (ModelState.IsValid) { subject.UpdateDt = DateTime.Now; subject.CreateDt = DateTime.Now; subject.IsDel = 0; string strMsg = string.Empty; bool b = GroupBll.AddAGroup(ref subject, out strMsg); if (b) { objResult = new ResultHelper() { Status = true, Ret = 0, Obj = subject, Msg = strMsg, Desc = strMsg }; } else { objResult = new ResultHelper() { Desc = strMsg, Msg = strMsg, Obj = null, Ret = -1, Status = false }; } //db.GroupInfo.Add(subject); //if (db.SaveChanges() > 0) //{ // objResult = new ResultHelper() // { // Status = true, // Ret = 0, // Obj = subject, // Msg = "Add Success!", // Desc = "Add Success!" // }; //} //else //{ // objResult = new ResultHelper() // { // Desc = "Add Faile,please try again.", // Msg = "Add Faile,please try again.", // Obj = null, // Ret = -1, // Status = false // }; //} } else { objResult = new ResultHelper() { Desc = " Faile,please try again", Msg = " Faile,please try again", Obj = null, Ret = -1, Status = false }; } } } catch (Exception ex) { objResult = new ResultHelper() { Desc = ex.Message, Msg = ex.Message, Obj = null, Ret = -1, Status = false }; } return(Json(objResult)); }
public ActionResult beginimp(string matchid, string fid) { try { List <tblmatchentity> lstMatchusers = new List <tblmatchentity>(); DataTable data = NpoiHelper.XlSToDataTable(System.IO.Path.Combine(Server.MapPath("~/upload/file"), fid), "TTBM", 0); GroupBll bll = new GroupBll(); tblmatch match = bll.GetMatchById(matchid); int sn = 0; string lineid = ""; string teamno = ""; string teamname = ""; string company = ""; int year = 0; int dm = 0; foreach (DataRow row in data.Rows) { year = 0; if (string.IsNullOrEmpty(row["队员姓名"].ToString().Trim())) { continue; } //记录序号,以标记团队 if (!string.IsNullOrEmpty(row["序号"].ToString().Trim())) { sn = int.Parse(row["序号"].ToString().Trim()); } if (!string.IsNullOrEmpty(row["路线名称"].ToString().Trim())) { var d = bll.GetLineByName(row["路线名称"].ToString().Trim()); lineid = d.Lineid; } if (!string.IsNullOrEmpty(row["队列号"].ToString().Trim())) { teamno = row["队列号"].ToString().Trim(); int.TryParse(teamno, out dm); } if (!string.IsNullOrEmpty(row["队名(6个字符以内)"].ToString().Trim())) { teamname = row["队名(6个字符以内)"].ToString().Trim(); } if (!string.IsNullOrEmpty(row["单位名称"].ToString().Trim())) { company = row["单位名称"].ToString().Trim(); } tblmatchentity muser = new tblmatchentity(); muser.Pnov = sn.ToString(); muser.Teamname = teamname; muser.Teamno = dm; muser.Cardno = row["身份证/护照"].ToString().Trim(); muser.Cardtype = "1"; muser.Leader = row["队员编号"].ToString().Trim() == "队长" ? 1 : 0; muser.Match_Id = matchid; muser.Mobile = row["手机号码"].ToString().Trim(); muser.Nickname = row["队员姓名"].ToString().Trim(); muser.Lineno = lineid; muser.Sexy = row["性别"].ToString().Trim() == "男" ? 1 : 0; muser.Passwd = company; int.TryParse(row["年龄"].ToString().Trim(), out year); muser.Age = year; muser.Mono = row["是否健康"].ToString().Trim(); lstMatchusers.Add(muser); } int count = 0; TeamRegBll tbll = new TeamRegBll(); int res = tbll.ImpTeams(lstMatchusers, ref count); return(RedirectToAction("importsuccess", new { m = HttpUtility.UrlEncode(match.Match_name), s = HttpUtility.UrlEncode(string.Format("已成功导入{0}个队伍,{1}个队员信息", count, res)) })); } catch (Exception ex) { ILog log = LogManager.GetLogger(this.GetType()); log.Error(ex); return(new EmptyResult()); } }
public JsonResult GetAllGroups() { List <Group> list = new GroupBll().GetAll().ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public string GetList() { var pager = GroupBll.GetList(UserContext.CurrentUser.HotelId); return(JsonConvert.SerializeObject(pager)); }