public TrackingDetails[] GetCompletedOrders(string det) { List <TrackingDetails> newlist = new List <TrackingDetails>(); List <string> list = new List <string>(); TrackingDetails[] res = null; try { res = new TrackingEntries().GetPendingOrders(det); if (res?.Count() > 0) { foreach (var item in res) { if (!string.IsNullOrEmpty(item?.DeliveredDate)) { newlist.Add(item); } } } return(newlist.ToArray()); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(newlist.ToArray()); }
public bool CheckMobileNumber(string number) { bool isPresent = false; try { using (driver) { using (var session = driver.Session()) { isPresent = !string.IsNullOrEmpty(session.Run("match (n:User) where n.Mobile='" + number + "' " + "return n.Mobile as Mobile"). Single().Values["Mobile"].ToString()) ? true : false; } } } catch (System.Exception ex) { if (ex.Message == "Sequence contains no elements") { isPresent = false; } else { LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, string.IsNullOrEmpty(frame.GetFileName()) ? "" : frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } } return(isPresent); }
public bool RemoveUser(User u) { bool isRemoved = false; try { //MATCH (n:User { UserId: 'Sylar' }) detach DELETE n using (driver) { using (var session = driver.Session()) { session.Run("" + "match (n:User { UserId:'" + u.UserId + "' ,Password:'******'}) " + "detach delete n"); isRemoved = true; } } } catch (System.Exception ex) { if (ex.Message == "Sequence contains no elements") { isRemoved = false; } else { LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, string.IsNullOrEmpty(frame.GetFileName()) ? "" : frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } } return(isRemoved); }
public string GetEmailAddress(string User) { string mail = ""; try { using (driver) { using (var session = driver.Session()) { mail = session.Run("match (n:User) where n.UserId='" + User + "' return n.Email as Email"). Single().Values["Email"].ToString(); } } } catch (System.Exception ex) { if (ex.Message == "Sequence contains no elements") { mail = ""; } else { LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, string.IsNullOrEmpty(frame.GetFileName()) ? "" : frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } } return(mail); }
private bool MapUserToAdmin(string userId) { bool isMapped = false; try { using (driver) { using (var session = driver.Session()) { var str = "match (n:User),(a:User) where a.UserId='" + userId + "'" + " and n.Name='Admin' create (n)-[r:CONTROLS_USER]->(a)"; session.Run(str); isMapped = true; } } } catch (System.Exception ex) { isMapped = false; LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, frame != null && !string.IsNullOrEmpty(frame.GetFileName()) ? frame.GetFileName() : this.GetType().Name + ".cs", ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(isMapped); }
public bool InsertUser(User member) { bool isRegistered = true; try { using (driver) { using (var session = driver.Session()) { session.Run( "create (a:User{FirstName:'" + member.FirstName + "',LastName:'" + member.LastName + "'," + "Age:'" + member.Age + "',Email:'" + member.Email + "'," + "Address1:'" + member.Address1 + "',Address2:'" + member.Address2 + "'," + "City:'" + member.City + "',Country:'" + member.Country + "',PinCode:'" + member.PinCode + "'," + "AreaCode:'" + member.AreaCode + "',Mobile:'" + member.MobileNumber + "',UserId:'" + member.UserId + "'," + "Password:'******',Role:'NormalUser'})"); isRegistered = MapUserToAdmin(member.UserId); } } } catch (System.Exception ex) { isRegistered = false; LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, frame != null && !string.IsNullOrEmpty(frame.GetFileName()) ? frame.GetFileName() : this.GetType().Name + ".cs", ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(isRegistered); }
public bool NotifyUser(NotifyUser obj) { try { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(obj.User); mail.Subject = "Notification mail - Radical ECart support team."; mail.Body = "You have subscribed for notification of the product " + obj.item + ". We will notify once its available online. " + "Thanks for your patience."; SmtpServer.UseDefaultCredentials = false; SmtpServer.Port = 587; SmtpServer.EnableSsl = true; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "qwerty123@Q"); SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network; SmtpServer.Send(mail); return(true); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); return(false); } }
public string GetEmailAddress(string User) { try { return(new RegisterUser().GetEmailAddress(User)); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); return(""); } }
public ProductDetails[] GetProductDetails() { try { list = new GetProducts().GetAllProducts(); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(list); }
public bool CheckUserId([FromBody] string userId) { bool isPresent = false; try { isPresent = new RegisterUser().CheckUserId(userId); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(isPresent); }
public string Login([FromBody] User member) { string ans = ""; try { ans = new RegisterUser().Login(member); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(ans); }
public bool EditTrackingDetails(TrackingDetails det) { bool res = false; try { res = new TrackingEntries().EditTrackingDates(det); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(res); }
public bool SavePaymentTransaction(TransactionDetails det) { bool successSave = false; try { successSave = new TransactionEntries().SaveTransaction(det); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(successSave); }
public TrackingDetails GetTrackingDetails(string id) { TrackingDetails det = null; try { det = new TrackingEntries().GetAllTrackingDetails(id); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(det); }
public bool UpdateProducts(ProductDetails det) { bool isUpdated = false; try { isUpdated = new GetProducts().UpdateProduct(det); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(isUpdated); }
public bool RemoveUser([FromBody] User u) { bool isRemoved = false; try { isRemoved = new RegisterUser().RemoveUser(u); } catch (System.Exception ex) { StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(isRemoved); }
public string CheckUserEmailAddress(string emailAddress) { string res = ""; try { res = new RegisterUser().CheckUserEmailAddress(emailAddress); } catch (System.Exception ex) { res = ""; StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(res); }
public bool UpdatePassword(User user) { bool isUpdated = false; try { isUpdated = new RegisterUser().UpdatePassword(user); } catch (System.Exception ex) { isUpdated = false; StackFrame frame = null; int line = 0; LogData.GetFrameDetails(ex, out frame, out line); LogData.LogExceptionData(ex.Message, frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(isUpdated); }
public bool UpdatePassword(User user) { // MATCH(n { name: 'Andy' }) //SET n.age = toString(n.age) //RETURN n.name, n.age bool isUpdated = false; try { using (driver) { using (var session = driver.Session()) { string command1 = "MATCH (n:User { UserId: '" + user.UserId + "' }) " + "RETURN n.Password as OldPassword"; string EncryptedOldPassword = session.Run(command1). Single().Values["OldPassword"].ToString(); string command = "MATCH (n:User { UserId: '" + user.UserId + "' }) SET n.Password" + " = '" + Encrypt(user.Password) + "' " + "RETURN n.Password as NewPassword"; string EncryptedNewPassword = session.Run(command). Single().Values["NewPassword"].ToString(); if (EncryptedOldPassword != EncryptedNewPassword) { isUpdated = true; } } } } catch (System.Exception ex) { if (ex.Message == "Sequence contains no elements") { isUpdated = false; } else { LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, string.IsNullOrEmpty(frame.GetFileName()) ? "" : frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } } return(isUpdated); }
public User GetUserDetails(string id) { try { using (driver) { using (var session = driver.Session()) { var cmd = "match (n:User{UserId:'" + id + "'}) return n.UserId as UserId," + "n.Email as Email,n.Age as Age,n.Address1 as Address1,n.Address2 as Address2," + "n.FirstName as Fname,n.LastName as Lname,n.Mobile as Phone,n.AreaCode as AreaCode," + "n.PinCode as PinCode,n.City as City,n.Country as Country"; var response = session.Run(cmd). Single(); return(new User { Age = response.Values["Age"].ToString(), UserId = response.Values["UserId"].ToString(), Email = response.Values["Email"].ToString(), Address1 = response.Values["Address1"].ToString(), Address2 = response.Values["Address2"].ToString(), FirstName = response.Values["Fname"].ToString(), LastName = response.Values["Lname"].ToString(), MobileNumber = response.Values["Phone"].ToString(), AreaCode = response.Values["AreaCode"].ToString(), PinCode = response.Values["PinCode"].ToString(), City = response.Values["City"].ToString(), Country = response.Values["Country"].ToString(), }); } } } catch (System.Exception ex) { LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, string.IsNullOrEmpty(frame.GetFileName()) ? "" : frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(null); }
public string Login(User member) { string ans = ""; try { using (driver) { using (var session = driver.Session()) { ans = session.Run("match (n:User) where n.Email='" + member.Email + "' and " + "n.Password='******' return n.UserId as UserId").Single(). Values["UserId"].ToString(); } } } catch (System.Exception ex) { LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, string.IsNullOrEmpty(frame.GetFileName()) ? "" : frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return(ans); }
public string EditDetails(User u) { bool isProceed = false; try { using (driver) { using (var session = driver.Session()) { var mobilecmd = "match (n:User{Mobile:'" + u.MobileNumber + "'}) return n.UserId as UserId"; var emailcmd = "match (n:User{Email:'" + u.Email + "'}) return n.UserId as UserId"; var mobResponse = session.Run(mobilecmd); var emailResponse = session.Run(emailcmd); try { var value = mobResponse.Single().Values["UserId"].ToString(); if (value == u.UserId) { isProceed = true; } else { isProceed = false; return("Mobile number already taken. Please try with another number."); } } catch { isProceed = true; } try { var value = emailResponse.Single().Values["UserId"].ToString(); if (value == u.UserId) { isProceed = true; } else { isProceed = false; return("Email address already taken. Please try with another email address."); } } catch { isProceed = true; } if (isProceed) { var cmd = "match (n:User{UserId:'" + u.UserId + "'}) " + "set n.Age='" + u.Age + "', n.PinCode='" + u.PinCode + "'," + "n.FirstName='" + u.FirstName + "'," + "n.LastName='" + u.LastName + "',n.City='" + u.City + "'," + "n.Country='" + u.Country + "',n.AreaCode='" + u.AreaCode + "'," + "n.Password='******',n.Email='" + u.Email + "'," + "n.Address1='" + u.Address1 + "',n.Address2='" + u.Address2 + "'," + " n.Mobile = '" + u.MobileNumber + "'"; session.Run(cmd); return("true"); } } } } catch (System.Exception ex) { LogData.GetFrameDetails(ex, out StackFrame frame, out int line); LogData.LogExceptionData(ex.Message, string.IsNullOrEmpty(frame.GetFileName()) ? "" : frame.GetFileName(), ex.InnerException != null ? ex.InnerException.Message : "No InnerException", line.ToString(), frame.GetMethod().Name); } return("false"); }