public ActionResult CancelDelegation(int Id) { deptId = GetDeptId(); DelegationDAO delegationDAO = new DelegationDAO(); //status = "completed"; //departmentDAO.UpdateDepartmentDelegation(deptId, delegationDAO.GetDelegationById(Id).EmployeeId, status); //delegationDAO.CancelDelegation(Id); if (!departmentDAO.CancelDelegation(deptId, Id)) { SetFlash(Enums.FlashMessageType.Error, "Something went wrong!"); return(RedirectToAction("Delegation", "DepartmentHead")); } ///// start Email ///// Delegation delegation = delegationDAO.GetDelegationById(Id); EmailDAO emailDAO = new EmailDAO(); Employee employee = emailDAO.EmailDelegation(delegation.EmployeeId); Email email = new Email(); email.SendEmail(employee.Email, "Delegation", "Dear " + delegation.EmployeeName + ",Please Check delegation status"); /////////////////////// SetFlash(Enums.FlashMessageType.Success, "You've cancelled Authority Delegation!"); return(RedirectToAction("Delegation", "DepartmentHead")); }
public ActionResult ListarEmail() { EmailDAO dao = new EmailDAO(); IList <Email> emails = dao.Lista(); return(View(emails)); }
public ActionResult ChangePassword(UserLoginVM vm) { string emailid = vm.UserName; var _user = entity.UserRegistrations.Where(cc => cc.EmailId == emailid && cc.Password == vm.Password).FirstOrDefault(); if (_user != null) { _user.Password = vm.NewPassword; entity.Entry(_user).State = EntityState.Modified; entity.SaveChanges(); EmailDAO _emaildao = new EmailDAO(); _emaildao.SendForgotMail(_user.EmailId, "User", vm.NewPassword); TempData["SuccessMsg"] = "Password Changed Successfully!"; return(RedirectToAction("Index", "Login")); //return Json(new { status = "ok", message = "Reset Password Details are sent,Check Email" }, JsonRequestBehavior.AllowGet); } else { //TempData["ErrorMsg"] = "Invalid EmailId or Password!"; Session["ResetStatus"] = "Reset"; Session["StatusMessage"] = "Invalid Credential!"; return(RedirectToAction("Index", "Login")); //return Json(new { status = "Failed", message = "Invalid EmailId!" }, JsonRequestBehavior.AllowGet); } }
public ActionResult ForgotPassword(UserLoginVM vm) { string emailid = vm.UserName; var _user = db.UserRegistrations.Where(cc => cc.UserName == emailid).FirstOrDefault(); if (_user != null) { PickupRequestDAO _dao = new PickupRequestDAO(); string newpassword = _dao.RandomPassword(6); _user.Password = newpassword; db.Entry(_user).State = EntityState.Modified; db.SaveChanges(); EmailDAO _emaildao = new EmailDAO(); _emaildao.SendForgotMail(_user.UserName, "User", newpassword); TempData["SuccessMsg"] = "Reset Password Details are sent,Check Email!"; return(RedirectToAction("Home", "Home")); //return Json(new { status = "ok", message = "Reset Password Details are sent,Check Email" }, JsonRequestBehavior.AllowGet); } else { Session["ForgotStatus"] = "Forgot"; Session["StatusMessage"] = "Invalid EmailId!"; return(RedirectToAction("Home", "Home")); //return Json(new { status = "Failed", message = "Invalid EmailId!" }, JsonRequestBehavior.AllowGet); } }
public ActionResult Adiciona(Email email) { EmailDAO dao = new EmailDAO(); dao.Adiciona(email); return(RedirectToAction("Menu", "Email")); }
public static Email EmailDAO_Email(EmailDAO s) { var e = new Email(); e.EmailID = s.ID; e.Email1 = s.Email; return(e); }
public static EmailDAO Email_EmailDAO(Email s) { var e = new EmailDAO(); e.ID = s.EmailID; e.Email = s.Email1; return(e); }
public static Email MapToEmail(EmailDAO email) { var e = new Email(); e.EmailID = email.Id; e.EmailAddress = email.Address; e.Active = email.Active; return(e); }
public static EmailDAO MapToEmailDAO(Email email) { var e = new EmailDAO(); e.Id = email.EmailID; e.Address = email.EmailAddress; e.Active = email.Active; return(e); }
public static EmailDTO MapToDTO(EmailDAO email) { var e = new EmailDTO(); e.Id = email.Id; e.Address = email.Address; e.Active = email.Active; return(e); }
public ActionResult ApproveRejectRequest(string status, int reqId) { RequestDAO chngStatus = new RequestDAO(); chngStatus.UpdateStatus(status, reqId); EmailDAO emailDAO = new EmailDAO(); Employee employee = emailDAO.EmailRequestStatus(reqId); string sender = Session["username"].ToString(); Email email = new Email(); email.SendEmail(employee.Email, "Requesation Status", "Dear" + employee.Name + ", \n Please check for Requestsation status. Regards,\n" + sender); return(RedirectToAction("ReviewStationeryRequest", "DepartmentHead")); }
public ActionResult GravarAlteracao(Email email) { EmailDAO dao = new EmailDAO(); Email novoEmail = dao.BuscaPorId(email.Id); novoEmail.NomeContato = email.NomeContato; novoEmail.NomeId = email.NomeId; novoEmail.EmailContato = email.EmailContato; dao.Atualiza(novoEmail); return(RedirectToAction("Menu", "Email")); }
public ActionResult AlterarEmail(int id) { using (var contexto = new AgendaContext()) { EmailDAO dao = new EmailDAO(); ViewBag.Email = dao.BuscaPorId(id); NomeDAO nomeDao = new NomeDAO(); IList <Nome> nomes = nomeDao.Lista(); ViewBag.Nomes = nomes; } return(View()); }
public JsonResult AddStationeryRequest(List <RequestStationery> itemData) { if (itemData == null) { return(Json("Your item list is empty!", JsonRequestBehavior.AllowGet)); } // add itemid to array int listLength = itemData.Count; string[] itemid = new string[listLength]; for (int i = 0; i < listLength; i++) { itemid[i] = itemData[i].ItemId; } //////////////////////////////////////////// ///////////////get employee////////////// EmployeeDAO employeeDAO = new EmployeeDAO(); Employee emp = new Employee(); emp = employeeDAO.GetEmployeeByUsername(Session["username"].ToString()); int empId = emp.Id; string deptId = emp.DepartmentId; /////////////////////////////////////////// RequestDAO req = new RequestDAO(); List <RequestStationery> reqStationery = new List <RequestStationery>(); reqStationery = itemData; if (req.CreateRequest(empId, reqStationery)) { EmailDAO emailDAO = new EmailDAO(); string mgrEmail = emailDAO.EmailReviewStationeryRequest(empId); Email email = new Email(); string message = "Please check for new stationery Request. Do not reply this is system generated message.Thanks " + emp.Name; email.SendEmail(mgrEmail, "New Stationery Request", message); return(Json("Successfully Added", JsonRequestBehavior.AllowGet)); } else { return(Json("Something went wrong! Please try again later.", JsonRequestBehavior.AllowGet)); } }
public ActionResult CollectionPoint(Department point) { string deptId = employeeDAO.GetDepartmentIdByDepartmentHeadUsername(Session["username"].ToString()); if (point.CollectionPoinId == 0 || point.RepName == null) { SetFlash(Enums.FlashMessageType.Error, "Please select both category!"); return(RedirectToAction("CollectionPoint", "DepartmentHead")); } else { int RepId = employeeDAO.GetEmployeeByName(deptId, point.RepName).Id; //departmentDAO.UpdateDepartmentCollectionPoint(deptId, point.CollectionPoinId); //if (!departmentDAO.UpdateDepartmentRepresentative(deptId, RepId)) //{ // SetFlash(Enums.FlashMessageType.Error, "Something went wrong!"); // return RedirectToAction("CollectionPoint", "DepartmentHead"); //} if (!departmentDAO.UpdateDeptRepAndColPt(deptId, RepId, point.CollectionPoinId)) { SetFlash(Enums.FlashMessageType.Error, "Something went wrong!"); return(RedirectToAction("CollectionPoint", "DepartmentHead")); } ///// Email start //////// EmailDAO emailDAO = new EmailDAO(); Employee employee = emailDAO.EmailUpdateDepartmentRep(point.CollectionPoinId); Email email = new Email(); string message = "Dear " + employee.Name + ", Please Check for Updated department Representative"; email.SendEmail(employee.Email, "New Stationery Request", message); ////////////////////////// SetFlash(Enums.FlashMessageType.Success, "Operation Succeeded!"); return(RedirectToAction("CollectionPoint", "DepartmentHead")); } }
public ActionResult Delegation(Delegation delegation) { deptId = GetDeptId(); status = "Ongoing"; string currentStatus = departmentDAO.GetDepartmentByDeptId(deptId).DelegateStatus; if (currentStatus == status) { SetFlash(Enums.FlashMessageType.Error, "You've already granted authourity to someone!"); return(RedirectToAction("Delegation", "DepartmentHead")); } else { delegation.EmployeeId = employeeDAO.GetEmployeeByName(deptId, delegation.EmployeeName).Id; if (!departmentDAO.InsertDelegation(delegation, deptId)) { SetFlash(Enums.FlashMessageType.Error, "Something went wrong!"); return(RedirectToAction("Delegation", "DepartmentHead")); } ///// start Email ///// EmailDAO emailDAO = new EmailDAO(); Employee employee = emailDAO.EmailDelegation(delegation.EmployeeId); Email email = new Email(); email.SendEmail(employee.Email, "Delegation", "Please Check delegation status"); /////////////////////// /// SetFlash(Enums.FlashMessageType.Success, "Authourity successfully granted!"); //delegationDAO.CreateDelegation(delegation); //departmentDAO.UpdateDepartmentDelegation(deptId, delegation.EmployeeId, status); return(RedirectToAction("Delegation", "DepartmentHead")); } }
public ActionResult Create(UserRegistrationVM v) { if (v.UserID == 0) { string status = "true"; UserRegistration x = (from b in db.UserRegistrations where b.UserName == v.EmailId select b).FirstOrDefault(); if (x != null) { TempData["ErrorMsg"] = "Email Id already exist!"; ViewBag.UserRole = db.RoleMasters.ToList(); return(View(v)); } UserRegistration a = new UserRegistration(); int max = (from c in db.UserRegistrations orderby c.UserID descending select c.UserID).FirstOrDefault(); a.UserID = max + 1; a.UserName = v.EmailId; a.Password = v.Password; a.RoleID = v.RoleID; a.Phone = ""; a.EmailId = v.EmailId; a.IsActive = v.IsActive; db.UserRegistrations.Add(a); db.SaveChanges(); if (a.RoleID == 13) //customer { var customer = db.CustomerMasters.Find(v.UserReferenceId); if (customer != null) { customer.UserID = a.UserID; db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); } } else if (a.RoleID == 14) //AGent { var agent = db.AgentMasters.Find(v.UserReferenceId); if (agent != null) { agent.UserID = a.UserID; db.Entry(agent).State = EntityState.Modified; db.SaveChanges(); } } else { var employee = db.EmployeeMasters.Find(v.UserReferenceId); if (employee != null) { employee.UserID = a.UserID; db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); } } if (v.EmailNotify == true) { EmailDAO _emaildao = new EmailDAO(); _emaildao.SendCustomerEmail(v.EmailId, v.UserName, v.Password); TempData["SuccessMsg"] = "You have successfully added User and Notification Mail has sent!"; } else { TempData["SuccessMsg"] = "You have successfully added User."; } } else { //UserRegistration uv = db.UserRegistrations.Find(v.UserID); var uv = db.UserRegistrations.Find(v.UserID);// (from c in db.UserRegistrations where c.UserID == v.UserID select c).FirstOrDefault(); //UserRegistration a = new UserRegistration(); //a.UserID = v.UserID; uv.UserName = v.EmailId; if (v.Password != null) { if (v.Password != uv.Password) { uv.Password = v.Password; } } //uv.RoleID = v.RoleID; uv.EmailId = v.EmailId; uv.IsActive = v.IsActive; db.Entry(uv).State = EntityState.Modified; db.SaveChanges(); if (uv.RoleID == 13) //customer { var customer = db.CustomerMasters.Find(v.UserReferenceId); if (customer != null) { customer.UserID = uv.UserID; db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); } } else if (uv.RoleID == 14) //AGent { var agent = db.AgentMasters.Find(v.UserReferenceId); if (agent != null) { agent.UserID = uv.UserID; db.Entry(agent).State = EntityState.Modified; db.SaveChanges(); } } else { var employee = db.EmployeeMasters.Find(v.UserReferenceId); if (employee != null) { employee.UserID = uv.UserID; db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); } } if (v.EmailNotify == true) { EmailDAO _emaildao = new EmailDAO(); _emaildao.SendCustomerEmail(v.EmailId, v.UserName, v.Password); TempData["SuccessMsg"] = "You have successfully Updated User Detail and Notification Mail has sent."; } else { TempData["SuccessMsg"] = "You have successfully Updated User."; } } return(RedirectToAction("Index")); }
public void UpdateEmail(Email email) { EmailDAO emailDAO = new EmailDAO(); emailDAO.UpdateEmail(email); }
public bool InsertEmail(EmailDAO email) { return(data.InsertEmail(EmailMapper.MapToEmail(email))); }
public bool ChangeEmail(EmailDAO email) { return(data.ChangeEmail(EmailMapper.MapToEmail(email))); }
public ActionResult Edit(AgentVM item) { UserRegistration u = new UserRegistration(); PickupRequestDAO _dao = new PickupRequestDAO(); int BranchID = Convert.ToInt32(Session["CurrentBranchID"].ToString()); int accompanyid = Convert.ToInt32(Session["CurrentCompanyID"].ToString()); AgentMaster a = db.AgentMasters.Find(item.ID); a.AcCompanyID = accompanyid; a.Name = item.AgentName; a.AgentCode = item.AgentCode; a.Address1 = item.Address1; a.Address2 = item.Address2; a.Address3 = item.Address3; a.Phone = item.Phone; a.Fax = item.Fax; a.WebSite = item.WebSite; a.ContactPerson = item.ContactPerson; a.CountryName = item.CountryName; a.CityName = item.CityName; a.LocationName = item.LocationName; a.CurrencyID = item.CurrencyID; // a.ZoneCategoryID = item.ZoneCategoryID; //a.AcHeadID = item.AcHeadID; a.CreditLimit = item.CreditLimit; a.AgentType = item.AgentType; if (item.StatusActive != null) { a.StatusActive = Convert.ToBoolean(item.StatusActive); } if (a.BranchID == null) { a.BranchID = BranchID; } UserRegistration x = null; if (a.UserID != null && a.UserID > 0) { x = (from b in db.UserRegistrations where b.UserID == a.UserID select b).FirstOrDefault(); } if (a.Email != item.Email || x == null) { if (x == null) { int max1 = (from c1 in db.UserRegistrations orderby c1.UserID descending select c1.UserID).FirstOrDefault(); int roleid = db.RoleMasters.Where(t => t.RoleName == "Agent").FirstOrDefault().RoleID; u.UserID = max1 + 1; u.UserName = item.Email; u.EmailId = item.Email; if (item.Password == "" || item.Password == null) { u.Password = _dao.RandomPassword(6); } else { u.Password = item.Password; } u.Phone = item.Phone; u.IsActive = true; u.RoleID = roleid; db.UserRegistrations.Add(u); db.SaveChanges(); a.Email = item.Email; a.UserID = u.UserID; } else { //checking duplicate UserRegistration x1 = (from b in db.UserRegistrations where b.UserName == item.Email && b.UserID != a.UserID select b).FirstOrDefault(); if (x1 == null) { x.EmailId = item.Email; if (item.Password == "") { x.Password = _dao.RandomPassword(6); } else { x.Password = item.Password; } db.Entry(x).State = EntityState.Modified; db.SaveChanges(); } a.Email = item.Email; a.UserID = x.UserID; } } else { if (a.UserID == null || a.UserID == 0) { int max1 = (from c1 in db.UserRegistrations orderby c1.UserID descending select c1.UserID).FirstOrDefault(); int roleid = db.RoleMasters.Where(t => t.RoleName == "Agent").FirstOrDefault().RoleID; u.UserID = max1 + 1; u.UserName = item.Email; u.EmailId = item.Email; if (item.Password == "") { u.Password = _dao.RandomPassword(6); } else { u.Password = item.Password; } u.Phone = item.Phone; u.IsActive = true; u.RoleID = roleid; db.UserRegistrations.Add(u); db.SaveChanges(); a.UserID = u.UserID; } else { u = (from b in db.UserRegistrations where b.UserID == a.UserID select b).FirstOrDefault(); if (item.Password != u.Password) { u.Password = item.Password; } db.Entry(u).State = EntityState.Modified; db.SaveChanges(); } } if (ModelState.IsValid) { db.Entry(a).State = EntityState.Modified; db.SaveChanges(); if (item.EmailNotify == true) { EmailDAO _emaildao = new EmailDAO(); _emaildao.SendCustomerEmail(item.Email, item.Email, u.Password); } TempData["SuccessMsg"] = "You have successfully Updated Agent."; return(RedirectToAction("Index")); } return(View()); }
public DataTable GetEmailAll() { EmailDAO emailDAO = new EmailDAO(); return(emailDAO.GetEmailAll()); }
public Email GetEmailById(int Id) { EmailDAO emailDAO = new EmailDAO(); return(emailDAO.GetEmailById(Id)); }
public void DeleteEmail(int Id) { EmailDAO emailDAO = new EmailDAO(); emailDAO.DeleteEmail(Id); }
public ActionResult Create(CustmorVM c) { string locationname = c.LocationName; string country = c.CountryName; string city = c.CityName; CustomerMaster obj = new CustomerMaster(); PickupRequestDAO _dao = new PickupRequestDAO(); if (c.CustomerID == 0) { int max = (from d in db.CustomerMasters orderby d.CustomerID descending select d.CustomerID).FirstOrDefault(); int accompanyid = Convert.ToInt32(Session["CurrentCompanyID"].ToString()); int branchid = Convert.ToInt32(Session["CurrentBranchID"].ToString()); obj.CustomerID = max + 1; obj.AcCompanyID = accompanyid; obj.CustomerCode = c.CustomerCode; // _dao.GetMaxCustomerCode(branchid); // c.CustomerCode; } else { obj = db.CustomerMasters.Find(c.CustomerID); } obj.CustomerName = c.CustomerName; obj.CustomerType = c.CustomerType; obj.ReferenceCode = c.ReferenceCode; obj.ContactPerson = c.ContactPerson; obj.Address1 = c.Address1; obj.Address2 = c.Address2; obj.Address3 = c.Address3; obj.Phone = c.Phone; obj.Mobile = c.Mobile; obj.Fax = c.Fax; obj.Email = c.Email; obj.WebSite = c.Website; obj.CountryID = c.CountryID; if (c.CityID == 0) { obj.CityID = null; } else { obj.CityID = c.CityID; } if (c.LocationID == 0) { obj.LocationID = null; } else { obj.LocationID = c.LocationID; } obj.CountryName = c.CountryName; obj.CityName = c.CityName; obj.LocationName = c.LocationName; if (c.CurrenceyID == 0) { c.CurrenceyID = Convert.ToInt32(Session["CurrencyId"].ToString()); } else { obj.CurrencyID = c.CurrenceyID; } obj.StatusActive = c.StatusActive; obj.CreditLimit = c.CreditLimit; obj.StatusTaxable = c.StatusTaxable; obj.EmployeeID = c.EmployeeID; obj.statusCommission = c.StatusCommission; obj.VATTRN = c.VATTRN; obj.CourierServiceID = c.CourierServiceID; obj.BranchID = Convert.ToInt32(Session["CurrentBranchID"].ToString()); obj.CustomerUsername = c.CustomerUsername; //obj.Password = c.Password; obj.Password = _dao.RandomPassword(6); obj.BusinessTypeId = c.BusinessTypeId; obj.Referal = c.Referal; obj.OfficeOpenTime = c.OfficeTimeFrom; obj.OfficeCloseTime = c.OfficeTimeTo; if (c.DepotID == null) { obj.DepotID = Convert.ToInt32(Session["CurrentDepotID"].ToString()); } else { obj.DepotID = c.DepotID; } if (c.CustomerType == "CR" && c.ChkApprovedBy) { obj.ApprovedBy = Convert.ToInt32(Session["UserID"]); obj.ApprovedOn = c.ApprovedOn; } //UserRegistration u = new UserRegistration(); //if (c.Email != null) //{ // if (c.Email != "") // { // UserRegistration x = (from a in db.UserRegistrations where a.UserName == c.Email select a).FirstOrDefault(); // if (x == null) // { // int max1 = (from c1 in db.UserRegistrations orderby c1.UserID descending select c1.UserID).FirstOrDefault(); // u.UserID = max1 + 1; // u.UserName = c.Email; // u.EmailId = c.Email; // u.Password = obj.Password; // u.Phone = c.Phone; // u.IsActive = true; // u.RoleID = c.RoleID; // } // try // { // db.UserRegistrations.Add(u); // db.SaveChanges(); // } // catch (DbEntityValidationException e) // { // foreach (var eve in e.EntityValidationErrors) // { // Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", // eve.Entry.Entity.GetType().Name, eve.Entry.State); // foreach (var ve in eve.ValidationErrors) // { // Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", // ve.PropertyName, ve.ErrorMessage); // } // } // } // } //} try { // obj.UserID = u.UserID; if (c.CustomerID > 0) { db.Entry(obj).State = EntityState.Modified; db.SaveChanges(); } else { db.CustomerMasters.Add(obj); db.SaveChanges(); ReceiptDAO.ReSaveCustomerCode(); } if (c.EmailNotify == true) { EmailDAO _emaildao = new EmailDAO(); _emaildao.SendCustomerEmail(c.Email, c.CustomerName, obj.Password); } } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } } TempData["SuccessMsg"] = "You have successfully added Customer."; return(RedirectToAction("Index")); return(View()); }
public ActionResult Create(AgentVM item) { int companyId = Convert.ToInt32(Session["CurrentCompanyID"].ToString()); int BranchID = Convert.ToInt32(Session["CurrentBranchID"].ToString()); int? max = (from c in db.AgentMasters orderby c.AgentID descending select c.AgentID).FirstOrDefault(); AgentMaster a = new AgentMaster(); PickupRequestDAO _dao = new PickupRequestDAO(); int roleid = db.RoleMasters.Where(t => t.RoleName == "Agent").FirstOrDefault().RoleID; UserRegistration u = new UserRegistration(); UserRegistration x = (from b in db.UserRegistrations where b.UserName == item.Email select b).FirstOrDefault(); if (x == null) { int max1 = (from c1 in db.UserRegistrations orderby c1.UserID descending select c1.UserID).FirstOrDefault(); u.UserID = max1 + 1; u.UserName = item.Email; u.EmailId = item.Email; if (item.Password == null) { u.Password = _dao.RandomPassword(6); } else { u.Password = item.Password; } u.Phone = item.Phone; u.IsActive = true; u.RoleID = roleid; db.UserRegistrations.Add(u); db.SaveChanges(); } if (max == null || max == 0) { a.AgentID = 1; a.Name = item.AgentName; a.AgentCode = item.AgentCode; a.Address1 = item.Address1; a.Address2 = item.Address2; a.Address3 = item.Address3; a.Phone = item.Phone; a.Fax = item.Fax; a.WebSite = item.WebSite; a.ContactPerson = item.ContactPerson; a.AcCompanyID = companyId; //a.CountryID = item.CountryID; //a.CityID = item.CityID; //a.LocationID = item.LocationID; a.CurrencyID = item.CurrencyID; a.ZoneCategoryID = item.ZoneCategoryID; a.AcHeadID = item.AcHeadID; a.CreditLimit = item.CreditLimit; a.CountryName = item.CountryName; a.CityName = item.CityName; a.LocationName = item.LocationName; a.Email = item.Email; a.Password = ""; a.AgentType = item.AgentType; a.UserID = u.UserID; if (item.StatusActive == null) { a.StatusActive = false; } else { a.StatusActive = Convert.ToBoolean(item.StatusActive); } a.BranchID = BranchID; } else { a.AgentID = Convert.ToInt32(max) + 1; a.Name = item.AgentName; a.AgentCode = item.AgentCode; a.Address1 = item.Address1; a.Address2 = item.Address2; a.Address3 = item.Address3; a.Phone = item.Phone; a.Fax = item.Fax; a.WebSite = item.WebSite; a.ContactPerson = item.ContactPerson; a.AcCompanyID = companyId; a.CountryName = item.CountryName; a.CityName = item.CityName; a.LocationName = item.LocationName; a.CurrencyID = item.CurrencyID; a.ZoneCategoryID = item.ZoneCategoryID; a.AcHeadID = item.AcHeadID; a.CreditLimit = item.CreditLimit; a.Email = item.Email; a.Password = ""; a.AgentType = item.AgentType; a.UserID = u.UserID; a.BranchID = BranchID; if (item.StatusActive == null) { a.StatusActive = false; } else { a.StatusActive = Convert.ToBoolean(item.StatusActive); } } try { db.AgentMasters.Add(a); db.SaveChanges(); if (item.EmailNotify == true) { EmailDAO _emaildao = new EmailDAO(); _emaildao.SendCustomerEmail(item.Email, item.Email, u.Password); } TempData["SuccessMsg"] = "You have successfully added Agent."; return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.currency = db.CurrencyMasters.ToList(); ViewBag.zonecategory = db.ZoneCategories.ToList(); ViewBag.achead = db.AcHeads.ToList(); ViewBag.roles = db.RoleMasters.ToList(); TempData["WarningMsg"] = ex.Message; return(View(item)); } }
public bool DeleteEmail(EmailDAO email) { return(data.DeleteEmail(EmailMapper.MapToEmail(email))); }
public void CreateEmail(Email email) { EmailDAO emailDAO = new EmailDAO(); emailDAO.CreateEmail(email); }