public ActionResult ManagerEdit(long id, string userName, string realName, string company, int language, ManagerTypeEnum managerType, string bindEmail) { short isAutoDistribute = Utils.CoreDefaultValue.False; if (!string.IsNullOrEmpty(Request["isAutoDistribute"])) { isAutoDistribute = Utils.CoreDefaultValue.True; } string responseCode = ResponseCode.NotFoundData; Manager manager = ManageService.GetManagerById(id); if (manager != null) { manager.UserName = userName; manager.RealName = realName; manager.Company = company; manager.Language = language; manager.IsAutoDistribute = isAutoDistribute; manager.ManagerType = managerType; manager.EncryptPassword(); manager.BindEmail = bindEmail; responseCode = ManageService.Save(CurrentManager, manager); } return(Json(InfoTools.GetMsgInfo(responseCode), JsonRequestBehavior.AllowGet)); }
static void PostMessage(long threadId, string eof) { StringBuilder textBuilder = new StringBuilder(); while (true) { String readedLine = ReadLine(); if (readedLine.Equals(eof)) { break; } textBuilder.Append(readedLine); textBuilder.Append('\n'); } using (Context context = new Context(config)) { long recepientId = context.MessagesThread .Where(u => u.Id == threadId) .Select(u => u.WithUser) .Single(); CMessage message = new CMessage(InfoTools.GetMessageThreadPublicId(context, threadId) , textBuilder.ToString(), DateTime.Now, recepientId, settings.UserPublicId); PushOperations.Insert(context, message, recepientId, settings.UserPublicId); context.SaveChanges(); } }
public ActionResult ResetPassword(long id) { string ipString = GetIP(); ManageService.ResetPassword(id, CurrentManager, ipString); return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok), JsonRequestBehavior.AllowGet)); }
public ActionResult ManagerProductEdit(long managerproductId, long mainSiteId, string productUrl, string productName, string productDescription) { string result = ManageService.ManagerProductUpdate(managerproductId, mainSiteId, productUrl, productName, productDescription, CurrentManager.RealName); return(Json(InfoTools.GetMsgInfo(result), JsonRequestBehavior.AllowGet)); }
public ActionResult ChangePassword(string oldPassword, string newPassword, string confirmPassword) { string ipString = GetIP(); string responseCode = ManageService.ChangePassword(CurrentManager, oldPassword, newPassword, confirmPassword, ipString); CurrentManager.Password = string.Empty; CookieHelper.SaveManagerCookie(CurrentManager); return(Json(InfoTools.GetMsgInfo(responseCode))); }
public ActionResult UserDefinedEdit(long id, string description) { if (id != 0 && !string.IsNullOrEmpty(description)) { UserDefined userDefined = BaseService.GetUserDefinedById(id); userDefined.Description = description; BaseService.SaveUserDefined(userDefined); return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok))); } return(Json(InfoTools.GetMsgInfo(ResponseCode.DataError), JsonRequestBehavior.AllowGet)); }
public ActionResult IntentionEdit(long id, string description) { if (id != 0 && !string.IsNullOrEmpty(description)) { Intention intention = BaseService.GetIntentionById(id); intention.Description = description; BaseService.SaveIntention(intention); return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok), JsonRequestBehavior.AllowGet)); } return(Json(InfoTools.GetMsgInfo(ResponseCode.DataError), JsonRequestBehavior.AllowGet)); }
public ActionResult RecoveryEnquiry(string enquiryIds) { if (!string.IsNullOrEmpty(enquiryIds)) { string[] enquiryIdArray = enquiryIds.Split(','); foreach (var enquiryId in enquiryIdArray) { EnquiryService.RecoveryEnquiry(long.Parse(enquiryId), CurrentManager); } } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok), JsonRequestBehavior.AllowGet)); }
public ActionResult TranslationDelete(string translationIds) { if (!string.IsNullOrEmpty(translationIds)) { string[] translationArray = translationIds.Split(','); foreach (var translationId in translationArray) { TranslationService.DeleteTranslation(long.Parse(translationId), CurrentManager.Id); } } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok), JsonRequestBehavior.AllowGet)); }
public ActionResult IssueEnquiryToChildManager(string enquiryIds, long managerId) { if (!string.IsNullOrEmpty(enquiryIds)) { string[] enquiryIdArray = enquiryIds.Split(','); foreach (var enquiryId in enquiryIdArray) { EnquiryService.IssueEnquiryToChild(managerId, long.Parse(enquiryId)); } } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok))); }
public ActionResult MoveEnquiryToUserDefined(string enquiryIds, long userDefinedId) { if (!string.IsNullOrEmpty(enquiryIds)) { string[] enquiryIdArray = enquiryIds.Split(','); foreach (var enquiryId in enquiryIdArray) { EnquiryService.MoveEnquiryToUseDefine(long.Parse(enquiryId), userDefinedId); } } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok))); }
public ActionResult RecoveryEmailTranlations(string translationIds) { if (!string.IsNullOrEmpty(translationIds)) { string[] translationArrays = translationIds.Split(','); foreach (var translationId in translationArrays) { TranslationService.RecoveryEmailTranlations(long.Parse(translationId)); } } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok))); }
public ActionResult IssueToChildManager(string translationIds, long managerId) { if (!string.IsNullOrEmpty(translationIds) && managerId != 0) { string[] translationArrays = translationIds.Split(','); foreach (var translationId in translationArrays) { TranslationService.IssueEmailToChildManager(long.Parse(translationId), managerId); } } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok))); }
public ActionResult Login(string userName, string password, bool remember) { Manager manager = null; string result = ManageService.Login(userName, password, out manager); if (result == ResponseCode.Ok) { ManageService.SaveLoginRecord(LoginRecordFactory.Create(userName, GetIp())); CookieHelper.SaveManagerCookie(manager, remember); } return(Json(InfoTools.GetMsgInfo(result))); }
public ActionResult MoveTransToIntention(string translationIds, long intentionId) { if (!string.IsNullOrEmpty(translationIds)) { string[] translationArray = translationIds.Split(','); foreach (var translationId in translationArray) { TranslationService.MoveToIntentionCustom(long.Parse(translationId), intentionId); } } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok), JsonRequestBehavior.AllowGet)); }
public ActionResult DictionaryAdd(string dataValue, string description, string datasort, ValueTypeEnum valueType) { int dataSort = 1; if (!int.TryParse(datasort, out dataSort)) { dataSort = 1; } BaseDictionary baseDictionary = BaseDictionaryFactory.Create(valueType, dataSort, dataValue, description, CurrentManager.UserName, description); string responseCode = BaseService.SaveDictionary(baseDictionary); return(Json(InfoTools.GetMsgInfo(responseCode), JsonRequestBehavior.AllowGet)); }
public ActionResult ManagerMainSiteAdd(string siteName, long language, string siteUrl, long managerId) { Manager manager = ManageService.GetManagerById(managerId); BaseDictionary baseDictionary = BaseService.GetDictionaryById(language); if (manager != null && baseDictionary != null) { ManagerMainSite managerMainSite = ManagerMainSiteFactory.Create(manager.Id, manager.RealName, siteName, siteUrl, baseDictionary.Id, baseDictionary.Value, CurrentManager.RealName); string result = ManageService.MainSiteSave(managerMainSite); return(Json(InfoTools.GetMsgInfo(result))); } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok))); }
public ActionResult IssueEnquiryToParentManager(string enquiryIds) { if (!string.IsNullOrEmpty(enquiryIds)) { long managerId = CurrentManager.ParentId; if (managerId == 0) { managerId = CurrentManager.Id; } string[] enquiryIdArray = enquiryIds.Split(','); foreach (var enquiryId in enquiryIdArray) { EnquiryService.IssueEnquiryToChild(managerId, long.Parse(enquiryId)); } } return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok), JsonRequestBehavior.AllowGet)); }
static void WriteMessages(long threadId) { String format = "{0,-4} {1,-25} {2,-12}\n{3}\n"; using (Context context = new Context(config)) { WriteLine(); var publicThreadId = InfoTools.GetMessageThreadPublicId(context, threadId); foreach (var message in context.Messages .Where(u => u.IdMessagesThread == publicThreadId)) { WriteLine("{0,-4} {1,-25} {2,-12}", "Id", "Date", "Sender"); WriteLine(format, message.Id, message.Date, InfoTools.GetMessageSenderUserId(context, message.Id), message.Text); } } }
private String GetMessages(long threadId) { String format = "{1}; {0}:\n{2}\n\n"; StringBuilder builder = new StringBuilder(); using (Context context = new Context(app.settings.Config)) { builder.AppendLine(); foreach (var message in context.Messages .Where(u => u.IdMessagesThread == threadId) .OrderBy(u => - u.Id)) { builder.AppendLine(string.Format(format, message.Date, InfoTools.GetMessageSenderShowName(context, message.Id), message.Text)); } } return(builder.ToString()); }
public ActionResult ManagerAdd(string userName, string password, string realName, string company, int language, ManagerTypeEnum managerType, string bindEmail) { short isAutoDistribute = Utils.CoreDefaultValue.False; if (!string.IsNullOrEmpty(Request["isAutoDistribute"])) { isAutoDistribute = Utils.CoreDefaultValue.True; } long parentId = CurrentManager.Id; Manager manager = ManagerFactory.Create(userName, password, parentId, managerType, realName, company, isAutoDistribute, language, CurrentManager.UserName, bindEmail); manager.EncryptPassword(); string responseCode = ManageService.Save(CurrentManager, manager); return(Json(InfoTools.GetMsgInfo(responseCode), JsonRequestBehavior.AllowGet)); }
public ActionResult DictionaryEdit(long id, string dataValue, string description, string datasort, ValueTypeEnum valueType) { int dataSort = 1; if (!int.TryParse(datasort, out dataSort)) { dataSort = 1; } BaseDictionary baseDictionary = BaseService.GetDictionaryById(id); if (baseDictionary != null) { baseDictionary.Value = dataValue; baseDictionary.Description = description; baseDictionary.DicId = dataSort; baseDictionary.ValueType = valueType; string responseCode = BaseService.SaveDictionary(baseDictionary); return(Json(InfoTools.GetMsgInfo(responseCode))); } return(Json(InfoTools.GetMsgInfo(ResponseCode.NotFoundData), JsonRequestBehavior.AllowGet)); }
public ActionResult ManagerMainSiteEdit(long mainSiteId, string siteName, long language, string siteUrl, long managerId) { ManagerMainSite managerMainSite = ManageService.GetManagerMainSiteById(mainSiteId); if (managerMainSite != null) { managerMainSite.SiteName = siteName; managerMainSite.SiteUrl = siteUrl; BaseDictionary baseDictionary = BaseService.GetDictionaryById(language); Manager manager = ManageService.GetManagerById(managerId); if (baseDictionary == null || manager == null) { return(Json(InfoTools.GetMsgInfo(ResponseCode.NotFoundData))); } managerMainSite.LanguageId = language; managerMainSite.LanguageName = baseDictionary.Value; managerMainSite.ManagerName = manager.RealName; managerMainSite.ManagerId = managerId; } return(Json(InfoTools.GetMsgInfo(ResponseCode.NotFoundData))); }
public ActionResult ManagerProductDelete(long id) { ManageService.ManagerProductDelete(id); return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok), JsonRequestBehavior.AllowGet)); }
public ActionResult UserDefinedDelete(long id) { BaseService.DeleteUserDefined(id); return(Json(InfoTools.GetMsgInfo(ResponseCode.Ok), JsonRequestBehavior.AllowGet)); }