public ResultModel ResendCode(subscriberModel obj) { ResultModel oOutput = new ResultModel(); try { Utitilty oUtility = new Utitilty(); obj.VerificationCode = oUtility.GetVerificationCode(3); var oSubscriberDetail = dbSet.Where(m => m.EmailAddress == obj.EmailAddress && m.GurudwaraCode == obj.GurudwaraCode).FirstOrDefault(); if (oSubscriberDetail != null) { oSubscriberDetail.VerificationCode = obj.VerificationCode; oSubscriberDetail.IsVerified = false; oDB.SaveChanges(); } #region Send Email Communication CommunicationModel oModel = new CommunicationModel(); oModel.AlertTypeID = 1; oModel.Contents = "Your Verification Code is " + obj.VerificationCode; oModel.Subject = "Verication Code"; oModel.SentTo = obj.EmailAddress; oModel.WhenToSend = DateTime.Now; oModel.CreatedDate = DateTime.Now; _svr.SendCommunication(oModel); #endregion } catch (Exception ex) { } return(oOutput); }
public ResultModel Delete(int Id) { ResultModel oOutput = new ResultModel(); try { Dictonarytb oReoord = dbSet.Where(m => m.ID == Id).FirstOrDefault(); if (oReoord != null) { DictonaryLanguage oDictonaryLanguage = oDB.DictonaryLanguage.Where(s => s.DictonarytbID == Id).FirstOrDefault(); if (oDictonaryLanguage != null) { oDB.DictonaryLanguage.Remove(oDictonaryLanguage); } DictonarySource oDictonarySource = oDB.DictonarySource.Where(s => s.DictonarytbID == Id).FirstOrDefault(); if (oDictonarySource != null) { oDB.DictonarySource.Remove(oDictonarySource); } dbSet.Remove(oReoord); oDB.SaveChanges(); oOutput.Status = 1; oOutput.Msg = "done"; } } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = "Data access error"; Services.Utitilty.Error(ex); } return(oOutput); }
public ResultModel Delete(int Id) { ResultModel oOutput = new ResultModel(); try { var oReoord = dbSet.Where(m => m.ID == Id).FirstOrDefault(); if (oReoord == null) { oOutput.Status = 0; oOutput.Msg = "Sorry, No record exist"; } else { oDB.Plans.Remove(oReoord); oDB.SaveChanges(); } } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = "Data access error"; Services.Utitilty.Error(ex); } return(oOutput); }
public ResultModel Insert(UserModel obj) { ResultModel oOutput = new ResultModel(); try { ApplicationUser ouser = new ApplicationUser(); ouser.FirstName = obj.FirstName; ouser.LastName = obj.LastName; ouser.ContactNumber = obj.ContactNumber; ouser.UserName = obj.UserName; ouser.EmailAddress = obj.EmailAddress; ouser.Password = obj.Password; // ouser.UserType = obj.UserType; // ouser.Status = obj.Status; dbSet.Add(ouser); oDB.SaveChanges(); oOutput.Data = ouser; } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = "Data access error"; Services.Utitilty.Error(ex); } return(oOutput); }
public bool SaveCommunication(CommunicationModel obj) { try { communication oComm = new communication(); oComm.SentTo = obj.SentTo; oComm.WhenToSend = obj.WhenToSend; oComm.SentTime = DateTime.Now; oComm.Subject = obj.Subject; oComm.AlertTypeID = 1; oComm.CommunicationStatusID = 3; oComm.Contents = obj.Contents; oComm.CreatedDate = DateTime.Now; oDB.Communication.Add(oComm); oDB.SaveChanges(); oDB.Dispose(); oDB = null; return(true); } catch (Exception ex) { throw; } return(false); }
public ResultModel Insert(GurudwaraServicesModel obj, ApplicationUser AppUser) { ResultModel oOutput = new ResultModel(); try { GurudwaraServices oServices = dbSet.Where(t => t.CompanyId == AppUser.CompanyID).FirstOrDefault(); if (oServices == null) { oServices = new GurudwaraServices(); obj.CreatedBy = AppUser.CreatedID == null ? 0 : AppUser.CreatedID.Value; obj.CreatedDate = DateTime.Now; obj.CompanyId = AppUser.CompanyID; GurudwaraServices oUser = Mapper.Map <GurudwaraServices>(obj); dbSet.Add(oServices); } else { oServices.ModifiedBy = AppUser.CreatedID == null ? 0 : AppUser.CreatedID.Value; oServices.ModifiedDate = DateTime.Now; oServices.ServicesDescription = obj.ServicesDescription; } oDB.SaveChanges(); oOutput.Data = Mapper.Map <GurudwaraServicesModel>(oServices); } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = ex.Message; Services.Utitilty.Error(ex); } return(oOutput); }
public ResultModel Insert(MenuTaskModel obj) { ResultModel oOutput = new ResultModel(); try { MenuTask oUser = Mapper.Map <MenuTask>(obj); dbSet.Add(oUser); oDB.SaveChanges(); } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = "Data access error"; Services.Utitilty.Error(ex); } return(oOutput); }
public ResultModel Insert(ApplicationUserModel obj) { ResultModel oOutput = new ResultModel(); try { ApplicationUser oUser = Mapper.Map <ApplicationUser>(obj); dbSet.Add(oUser); db.SaveChanges(); oOutput.Data = oUser; } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = "Data access error"; Services.Utitilty.Error(ex); } return(oOutput); }
public ResultModel Delete(int Id) { ResultModel oOutput = new ResultModel(); try { Source oReoord = dbSet.Where(m => m.ID == Id).FirstOrDefault(); if (oReoord != null) { dbSet.Remove(oReoord); oDB.SaveChanges(); oOutput.Status = 1; oOutput.Msg = "done"; } } catch (Exception ex) { oOutput.Status = 0; oOutput.Msg = "Data access error"; Services.Utitilty.Error(ex); } return(oOutput); }