public ActionResult TaskReport(string MenuId) { TaskRepository tskDB = RepositoryManager.GetRepository <TaskRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); var totalActiveTasks = tskDB.GetTaskList(SessionContext.Current.ActiveUser.UserUid.ToString(), DateTime.MinValue, DateTime.MaxValue); TaskReport model = new TaskReport(); model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; model.taskStatus = tskDB.GetTaskStatusList(); model.task_status_id = "0"; model.activeUsers = gnlDB.GetActiveUsers(); model.assigned_user_id = SessionContext.Current.ActiveUser.UserUid.ToString(); ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Report/TaskReport.rdlc"; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("TaskReportDataSet", totalActiveTasks)); reportViewer.Height = 450; reportViewer.Width = 1000; reportViewer.AsyncRendering = false; ViewBag.ReportViewer = reportViewer; return(View(model)); }
public ActionResult UserProfile(string RecordId, string MenuId) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); User model = new User(); MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; Guid recordId = Guid.Empty; if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = gnlDB.BindUser(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } return(View(model)); }
public JsonResult UserList(string type, string query) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); string list = string.Empty; List <UserListModel> userListModel = new List <UserListModel>(); if (type == "ALL") { List <gnl_users> userList = gnlDB.GetUserByNameSurname(query.ToUpperInvariant()); foreach (var item in userList) { UserListModel model = new UserListModel(); model.value = item.name + " " + item.surname; UserListCategoryModel data = new UserListCategoryModel(); data.category = ""; data.id = item.user_id.ToString(); model.data = data; userListModel.Add(model); } } JavaScriptSerializer js = new JavaScriptSerializer(); string userListModelStr = js.Serialize(userListModel); string resultArray = "{\"suggestions\":" + userListModelStr + " }"; list = js.Serialize(resultArray); return(Json(list, JsonRequestBehavior.AllowGet)); }
public static bool IsAuthorized(string menuId, string permissionType, string userId) { bool result = false; if (!string.IsNullOrEmpty(menuId)) { DataSet dsMenuRights = BaseDB.DBManager.AppConnection.ExecuteSP("gnl_all_user_authorization_select_sp", new ArrayList { "user_id" }, new ArrayList { userId }); DataView dw = dsMenuRights.Tables[0].DefaultView; dw.RowFilter = String.Format("menu_id={0} and {1}=1", menuId, permissionType); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); result = dw.Count > 0; if (GlobalHelper.IsGuid(userId)) { gnl_users user = gnlDB.GetUser(Guid.Parse(userId)); if (user.is_administrator != null && user.is_administrator.Value == true) { result = true; } } } return(result); }
public ActionResult Tasks(string RecordId, string MenuId, string FromNotification, string NotificationId) { CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); TaskRepository tskDB = RepositoryManager.GetRepository <TaskRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); Task model = new Task(); MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; Guid recordId = Guid.Empty; model.activeProjects = crmDB.GetProjectList(); model.activeUsers = gnlDB.GetActiveUsers(); model.taskStatus = tskDB.GetTaskStatusList(); model.taskPriority = tskDB.GetTaskPriorityList(); if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = tskDB.BindTask(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; if (FromNotification == "1" && GlobalHelper.IsGuid(NotificationId)) { gnlDB.UpdateNotificationShown(Guid.Parse(NotificationId)); } } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { if (recordId == Guid.Empty) { model.task_user_id = SessionContext.Current.ActiveUser.UserUid.ToString(); model.assigned_user_id = SessionContext.Current.ActiveUser.UserUid.ToString(); } } return(View(model)); }
public PartialViewResult NotificationList(string userId) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); if (GlobalHelper.IsGuid(userId)) { var list = gnlDB.GetActiveNotificationByUser(Guid.Parse(userId)); Session["ListNotification"] = list; } return(PartialView("NotificationList")); }
public ActionResult User(string RecordId, string MenuId) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); User model = new User(); MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; Guid recordId = Guid.Empty; model.activeGroups = gnlDB.GetActiveGroups(); if (model.activeGroups != null && model.activeGroups.Count > 0) { model.SelectedGroupId = model.activeGroups[0].group_id.ToString(); } if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = gnlDB.BindUser(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } if (!string.IsNullOrEmpty(model.ManagerId) && GlobalHelper.IsGuid(model.ManagerId)) { gnl_users userManager = gnlDB.GetUser(Guid.Parse(model.ManagerId)); if (userManager != null) { model.ManagerName = userManager.name + " " + userManager.surname; } } return(View(model)); }
public PartialViewResult RoleRelatedUsers(string role_id, string user_id, string input) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); gnl_roles_related_users role_related_users = new gnl_roles_related_users(); Role model = new Role(); Guid role_uid = Guid.Empty; Guid user_uid = Guid.Empty; if (Guid.TryParse(role_id, out role_uid) && Guid.TryParse(user_id, out user_uid)) { if (role_uid != Guid.Empty && user_uid != Guid.Empty) { List <gnl_role_related_users_v> list = gnlDB.GetRoleRelatedUsers(role_uid); if (list.Where(x => x.user_id == user_uid).Count() <= 0) { model.role_id = role_uid; model.user_id = user_uid; gnlDB.AddRoleRelatedUsers(role_related_users, model); } else { if (input != "") { model.errorMessage = Resources.GlobalResource.role_related_users_defined; } } } else { if (input != "") { model.errorMessage = Resources.GlobalResource.role_related_role_not_defined; } } } List <gnl_role_related_users_v> listRoleRelatedUsers = gnlDB.GetRoleRelatedUsers(role_uid); model.roleRelatedUsers = listRoleRelatedUsers; return(PartialView("RoleRelatedUsers", model)); }
public ActionResult RoleAuthorization(string MenuId) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); RoleAuthorization model = new RoleAuthorization(); model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; model.activeRoles = gnlDB.GetActiveRoles(); if (model.activeRoles != null && model.activeRoles.Count > 0) { model.SelectedRoleId = model.activeRoles[0].role_id.ToString(); SessionContext.Current.ActiveUser.SelectedRoleId = model.SelectedRoleId; } return(View(model)); }
public JsonResult GetNotificationCount(string userId) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); int count = 0; if (GlobalHelper.IsGuid(userId)) { var list = gnlDB.GetActiveNotificationByUser(Guid.Parse(userId)); if (list != null && list.Count > 0) { count = list.Count; } } var modelNotification = new { count = count }; return(Json(modelNotification, JsonRequestBehavior.AllowGet)); }
public static bool HasAuthorizedChild(string parentMenuId) { DataSet dsMenuRights = BaseDB.DBManager.AppConnection.ExecuteSP("gnl_user_authorization_child_menu_rights_select_sp", new ArrayList { "user_id", "parent_menu_id" }, new ArrayList { SessionContext.Current.ActiveUser.UserUid, parentMenuId }); bool result = false; GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); result = dsMenuRights.Tables[0].Rows.Count > 0; gnl_users user = gnlDB.GetUser(SessionContext.Current.ActiveUser.UserUid); if (user.is_administrator != null && user.is_administrator.Value == true) { result = true; } return(result); }
public ActionResult Role(string RecordId, string MenuId) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); Role model = new Role(); MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; Guid recordId = Guid.Empty; if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = gnlDB.BindRole(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } Guid role_uid = Guid.Empty; if (Guid.TryParse(model.RecordId, out role_uid)) { List <gnl_role_related_users_v> listRoleRelatedUsers = gnlDB.GetRoleRelatedUsers(role_uid); model.roleRelatedUsers = listRoleRelatedUsers; } return(View(model)); }
public PartialViewResult RoleRelatedUsersDelete(string role_id, string id) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); gnl_roles_related_users role_related_users = new gnl_roles_related_users(); Role model = new Role(); Guid role_uid = Guid.Empty; Guid user_uid = Guid.Empty; if (Guid.TryParse(role_id, out role_uid) && BaseFunctions.getInstance().IsNumeric(id)) { var obj = gnlDB.GetRoleRelatedUsersById(Convert.ToInt32(id)); if (obj != null && obj.Count > 0) { gnlDB.DeleteRoleRelatedUsers(obj[0]); } } List <gnl_role_related_users_v> listRoleRelatedUsers = gnlDB.GetRoleRelatedUsers(role_uid); model.roleRelatedUsers = listRoleRelatedUsers; return(PartialView("RoleRelatedUsers", model)); }
public ActionResult Role(Role model) { Guid recordId = Guid.Empty; GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; ModelState.Remove("is_active"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { gnlDB.DeleteRole(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { model = gnlDB.UpdateRole(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { gnl_roles role = new gnl_roles(); gnlDB.AddRole(role, model); model.RecordId = role.role_id.ToString(); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } Guid role_uid = Guid.Empty; if (Guid.TryParse(model.RecordId, out role_uid)) { List <gnl_role_related_users_v> listRoleRelatedUsers = gnlDB.GetRoleRelatedUsers(role_uid); model.roleRelatedUsers = listRoleRelatedUsers; } } return(View(model)); }
public ActionResult Group(Group model) { Guid recordId = Guid.Empty; GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; ModelState.Remove("is_active"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { gnlDB.DeleteGroup(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { model = gnlDB.UpdateGroup(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { gnl_user_groups group = new gnl_user_groups(); gnlDB.AddGroup(group, model); model.RecordId = group.group_id.ToString(); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } if (string.IsNullOrEmpty(model.ManagerName)) { model.ManagerId = null; } if (!string.IsNullOrEmpty(model.ManagerId) && GlobalHelper.IsGuid(model.ManagerId)) { gnl_users userManager = gnlDB.GetUser(Guid.Parse(model.ManagerId)); if (userManager != null) { model.ManagerName = userManager.name + " " + userManager.surname; } } } return(View(model)); }
public JsonResult GetCalendar() { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); CalendarList model = new CalendarList(); DataSet dsCalendar = new DataSet(); if (Dcm.Source.GlobalHelper.IsAuthorized("110", "menu_right", BaseDB.SessionContext.Current.ActiveUser.UserUid.ToString())) { dsCalendar = gnlDB.GetAllCalendar(); } else { dsCalendar = gnlDB.GetCalendar(); } model.calendarListItems = new List <CalendarItem>(); int counter = 0; foreach (DataRow dr in dsCalendar.Tables[0].Rows) { CalendarItem item = new CalendarItem(); string[] startArr = null; string[] endArr = null; if ((dr["start_date"] != null && dr["start_date"].ToString() != "")) { startArr = dr["start_date"].ToString().Split('.'); } if ((dr["end_date"] != null && dr["end_date"].ToString() != "")) { endArr = dr["end_date"].ToString().Split('.'); } item.title = dr["assigned_user_name"].ToString() + " - " + dr["task_status_name"].ToString() + " - " + dr["task_name"].ToString(); item.start = (dr["start_date"] != null && dr["start_date"].ToString() != "") ? startArr[2] + "-" + startArr[1] + "-" + startArr[0] : ""; item.end = (dr["end_date"] != null && dr["end_date"].ToString() != "") ? endArr[2] + "-" + endArr[1] + "-" + endArr[0] : ""; if (dr["task_status_id"].ToString() == "2") { item.backgroundColor = "#ff1800"; } else if (dr["task_status_id"].ToString() == "3" || dr["task_status_id"].ToString() == "4") { item.backgroundColor = "#ff9600"; } else if (dr["task_status_id"].ToString() == "5") { item.backgroundColor = "#195794"; } else if (dr["task_status_id"].ToString() == "6") { item.backgroundColor = "#50a100"; } else if (dr["task_status_id"].ToString() == "7") { item.backgroundColor = "#5aa5cc"; } item.url = Url.Content("~/Task/Tasks?RecordId=" + dr["task_id"].ToString() + "&MenuId=" + @Dcm.Source.GlobalHelper.Encrypt("149")); model.calendarListItems.Add(item); counter++; } return(Json(model.calendarListItems, JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { Index model = new Models.Index(); SessionContext.Current.ActiveUser.MenuId = "0"; DataSet totalActiveTask = BaseDB.DBManager.AppConnection.GetDataSet("select count(*) kayit_sayisi from tsk_tasks_v where is_active_bit=@is_active_bit ", new ArrayList { "is_active_bit" }, new ArrayList { 1 }); DataSet totalActiveFinishedTask = BaseDB.DBManager.AppConnection.GetDataSet("select count(*) kayit_sayisi from tsk_tasks_v where is_active_bit=@is_active_bit and task_status_id=@task_status_id ", new ArrayList { "is_active_bit", "task_status_id" }, new ArrayList { 1, 6 }); DataSet totalActiveClosedTask = BaseDB.DBManager.AppConnection.GetDataSet("select count(*) kayit_sayisi from tsk_tasks_v where is_active_bit=@is_active_bit and task_status_id=@task_status_id ", new ArrayList { "is_active_bit", "task_status_id" }, new ArrayList { 1, 7 }); DataSet totalActiveProcessedTask = BaseDB.DBManager.AppConnection.GetDataSet("select count(*) kayit_sayisi from tsk_tasks_v where is_active_bit=@is_active_bit and task_status_id in (2,3,4,8) ", new ArrayList { "is_active_bit" }, new ArrayList { 1 }); model.totalActiveTask = (totalActiveTask != null && totalActiveTask.Tables[0].Rows.Count > 0) ? totalActiveTask.Tables[0].Rows[0]["kayit_sayisi"].ToString():"0"; model.totalActiveFinishedTask = (totalActiveFinishedTask != null && totalActiveFinishedTask.Tables[0].Rows.Count > 0) ? totalActiveFinishedTask.Tables[0].Rows[0]["kayit_sayisi"].ToString():"0"; model.totalActiveClosedTask = (totalActiveClosedTask != null && totalActiveClosedTask.Tables[0].Rows.Count > 0) ? totalActiveClosedTask.Tables[0].Rows[0]["kayit_sayisi"].ToString():"0"; model.totalActiveProcessedTask = (totalActiveProcessedTask != null && totalActiveProcessedTask.Tables[0].Rows.Count > 0) ? totalActiveProcessedTask.Tables[0].Rows[0]["kayit_sayisi"].ToString() : "0"; DataSet totalActiveTaskMy = BaseDB.DBManager.AppConnection.GetDataSet("select count(*) kayit_sayisi from tsk_tasks_v where is_active_bit=@is_active_bit and assigned_user_id=@assigned_user_id", new ArrayList { "is_active_bit", "assigned_user_id" }, new ArrayList { 1, SessionContext.Current.ActiveUser.UserUid }); DataSet totalActiveFinishedTaskMy = BaseDB.DBManager.AppConnection.GetDataSet("select count(*) kayit_sayisi from tsk_tasks_v where is_active_bit=@is_active_bit and task_status_id=@task_status_id and assigned_user_id=@assigned_user_id", new ArrayList { "is_active_bit", "task_status_id", "assigned_user_id" }, new ArrayList { 1, 6, SessionContext.Current.ActiveUser.UserUid }); DataSet totalActiveClosedTaskMy = BaseDB.DBManager.AppConnection.GetDataSet("select count(*) kayit_sayisi from tsk_tasks_v where is_active_bit=@is_active_bit and task_status_id=@task_status_id and assigned_user_id=@assigned_user_id", new ArrayList { "is_active_bit", "task_status_id", "assigned_user_id" }, new ArrayList { 1, 7, SessionContext.Current.ActiveUser.UserUid }); DataSet totalActiveProcessedTaskMy = BaseDB.DBManager.AppConnection.GetDataSet("select count(*) kayit_sayisi from tsk_tasks_v where is_active_bit=@is_active_bit and task_status_id in (2,3,4,8) and assigned_user_id=@assigned_user_id", new ArrayList { "is_active_bit", "assigned_user_id" }, new ArrayList { 1, SessionContext.Current.ActiveUser.UserUid }); model.totalActiveTaskMy = (totalActiveTaskMy != null && totalActiveTaskMy.Tables[0].Rows.Count > 0) ? totalActiveTaskMy.Tables[0].Rows[0]["kayit_sayisi"].ToString() : "0"; model.totalActiveFinishedTaskMy = (totalActiveFinishedTaskMy != null && totalActiveFinishedTaskMy.Tables[0].Rows.Count > 0) ? totalActiveFinishedTaskMy.Tables[0].Rows[0]["kayit_sayisi"].ToString() : "0"; model.totalActiveClosedTaskMy = (totalActiveClosedTaskMy != null && totalActiveClosedTaskMy.Tables[0].Rows.Count > 0) ? totalActiveClosedTaskMy.Tables[0].Rows[0]["kayit_sayisi"].ToString() : "0"; model.totalActiveProcessedTaskMy = (totalActiveProcessedTaskMy != null && totalActiveProcessedTaskMy.Tables[0].Rows.Count > 0) ? totalActiveProcessedTaskMy.Tables[0].Rows[0]["kayit_sayisi"].ToString() : "0"; #region Görev Bitiş Tarihi Geçmiş Olanların Bildirimleri Oluşturuluyor try { TaskRepository tskDB = RepositoryManager.GetRepository <TaskRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); DataSet dsExpireTask = tskDB.SendTaskExpireNotification(); foreach (DataRow row in dsExpireTask.Tables[0].Rows) { gnlDB.AddNotification(Guid.Parse(row["task_id"].ToString()), Guid.Parse(row["task_user_id"].ToString()), (int)Enums.NotificationType.Expire, (int)Enums.NotificationModuleType.Task, Resources.GlobalResource.task_expire_end_date_title, Resources.GlobalResource.task_expire_end_date_body); gnlDB.Kaydet(); gnlDB.AddNotification(Guid.Parse(row["task_id"].ToString()), Guid.Parse(row["assigned_user_id"].ToString()), (int)Enums.NotificationType.Expire, (int)Enums.NotificationModuleType.Task, Resources.GlobalResource.task_expire_end_date_title, Resources.GlobalResource.task_expire_end_date_body); gnlDB.Kaydet(); tsk_tasks task = new tsk_tasks(); task = tskDB.GetTask(Guid.Parse(row["task_id"].ToString())); tskDB.TaskMailSend(Guid.Parse(row["task_user_id"].ToString()), task.order_id.ToString(), task.task_name, task.task_id, "Task End Date Expired", "", "", "99"); tskDB.TaskMailSend(Guid.Parse(row["assigned_user_id"].ToString()), task.order_id.ToString(), task.task_name, task.task_id, "Task End Date Expired", "", "", "99"); } } catch (Exception exp) { } #endregion return(View(model)); }
public ActionResult UserProfile(User model) { Guid recordId = Guid.Empty; GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; ModelState.Remove("name"); ModelState.Remove("surname"); ModelState.Remove("email"); ModelState.Remove("mobile_phone"); ModelState.Remove("address"); if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { string password = gnlDB.GetUserPassword(recordId); if (string.IsNullOrEmpty(model.oldPassword)) { ViewBag.Success = false; ModelState.AddModelError("Error", Resources.GlobalResource.old_password_not_null); } else if (string.IsNullOrEmpty(model.newPassword)) { ViewBag.Success = false; ModelState.AddModelError("Error", Resources.GlobalResource.new_password_not_null); } else if (string.IsNullOrEmpty(model.newPasswordRepeat)) { ViewBag.Success = false; ModelState.AddModelError("Error", Resources.GlobalResource.new_password_repeat_not_null); } else if (password != GlobalHelper.EncriptText(model.oldPassword)) { ViewBag.Success = false; ModelState.AddModelError("Error", Resources.GlobalResource.wrong_old_password); } else if (model.newPassword != model.newPasswordRepeat) { ViewBag.Success = false; ModelState.AddModelError("Error", Resources.GlobalResource.wrong_repeat_password); } else { model.password = GlobalHelper.EncriptText(model.newPassword.Trim()); model = gnlDB.UpdateUserPassword(model, recordId); if (!string.IsNullOrEmpty(model.password)) { ViewBag.ResultMessage = Resources.GlobalResource.transaction_success_with_password; } else { ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } } model = gnlDB.BindUser(model, recordId); } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } return(View(model)); }
public ActionResult RoleAuthorization(RoleAuthorization model, FormCollection formCollection) { GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); model.activeRoles = gnlDB.GetActiveRoles(); ViewBag.Success = true; SessionContext.Current.ActiveUser.FromUpdateButton = model.FromUpdateButton; SessionContext.Current.ActiveUser.SelectedRoleId = model.SelectedRoleId; if (SessionContext.Current.ActiveUser.FromUpdateButton == "1") { try { gnlDB.DeleteRoleRights(model.SelectedRoleId); DataSet dsMenu = BaseDB.DBManager.AppConnection.GetDataSet("select * from gnl_menu"); foreach (DataRow row in dsMenu.Tables[0].Rows) { bool menuRight = false; bool deleteRight = false; bool updateRight = false; bool reportRight = false; bool newRecordRight = false; foreach (var key in formCollection.AllKeys) { string[] arr = key.Split('_'); if (arr.Length > 1) { if (arr[1] != "" && BaseFunctions.getInstance().IsNumeric(arr[1]) && arr[1] == row["menu_id"].ToString()) { if (arr[0] == "Show") { menuRight = true; } if (arr[0] == "Update") { updateRight = true; } if (arr[0] == "Delete") { deleteRight = true; } if (arr[0] == "Report") { reportRight = true; } if (arr[0] == "NewRecord") { newRecordRight = true; } } } } gnl_role_rights rights = new gnl_role_rights(); gnlDB.AddRoleRights(rights, Guid.Parse(model.SelectedRoleId), Convert.ToInt32(row["menu_id"].ToString()), menuRight, updateRight, deleteRight, reportRight, newRecordRight); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } return(View(model)); }
public ActionResult Projects(Project model) { Guid recordId = Guid.Empty; CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); #region Ortak Set Edilecek Değerler SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; #endregion model.activeKurumlar = crmDB.GetKurumList(); model.activeBireyler = crmDB.GetBireyList(); model.activeUsers = gnlDB.GetActiveUsers(); model.projectTypes = crmDB.GetProjectTypeList(); model.activeBireylerKurumlar = crmDB.GetBireyKurumList(); model.project_type_id = "1"; ModelState.Remove("is_active"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { crmDB.DeleteProject(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { model = crmDB.UpdateProject(model, recordId); if (model.birey_id != null && GlobalHelper.IsGuidOrEmpty(model.birey_id)) { model.birey_id = model.birey_id.ToString(); } if (model.kurum_id != null && GlobalHelper.IsGuidOrEmpty(model.kurum_id)) { model.kurum_id = model.kurum_id.ToString(); } if (model.statik != null && GlobalHelper.IsGuidOrEmpty(model.statik)) { model.statik = model.statik.ToString(); } if (model.mekanik != null && GlobalHelper.IsGuidOrEmpty(model.mekanik)) { model.mekanik = model.mekanik.ToString(); } if (model.elektrik != null && GlobalHelper.IsGuidOrEmpty(model.elektrik)) { model.elektrik = model.elektrik.ToString(); } if (model.harita != null && GlobalHelper.IsGuidOrEmpty(model.harita)) { model.harita = model.harita.ToString(); } if (model.yapi_denetim != null && GlobalHelper.IsGuidOrEmpty(model.yapi_denetim)) { model.yapi_denetim = model.yapi_denetim.ToString(); } if (model.isveren_mobil_phone != null) { model.isveren_mobil_phone = model.isveren_mobil_phone.ToString(); } if (model.proje_metrekare != null && !string.IsNullOrEmpty(model.proje_metrekare.ToString())) { model.proje_metrekare = model.proje_metrekare.ToString(); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { crm_projects project = new crm_projects(); crmDB.AddProject(project, model); model.RecordId = project.project_id.ToString(); if (project.birey_id != null) { model.birey_id = project.birey_id.ToString(); } if (project.kurum_id != null) { model.kurum_id = project.kurum_id.ToString(); } if (project.statik != null) { model.statik = project.statik.ToString(); } if (project.mekanik != null) { model.mekanik = project.mekanik.ToString(); } if (project.elektrik != null) { model.elektrik = project.elektrik.ToString(); } if (project.harita != null) { model.harita = project.harita.ToString(); } if (project.yapı_denetimi != null) { model.yapi_denetim = project.yapı_denetimi.ToString(); } if (project.isveren_mobile_phone != null) { model.isveren_mobil_phone = project.isveren_mobile_phone.ToString(); } if (project.metre_kare != null && !string.IsNullOrEmpty(model.proje_metrekare.ToString())) { model.proje_metrekare = project.metre_kare.ToString(); model.proje_metrekare = model.proje_metrekare.Replace(',', '.'); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } } return(View(model)); }
public ActionResult Tasks(Task model) { Guid recordId = Guid.Empty; TaskRepository tskDB = RepositoryManager.GetRepository <TaskRepository>(); CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; model.activeProjects = crmDB.GetProjectList(); model.activeUsers = gnlDB.GetActiveUsers(); model.taskStatus = tskDB.GetTaskStatusList(); model.taskPriority = tskDB.GetTaskPriorityList(); ModelState.Remove("is_active"); ModelState.Remove("is_task_sent"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { tskDB.DeleteTask(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else if (model.FromCreateTaskButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { tskDB.UpdateTaskStatus(model, Guid.Parse(model.RecordId), (int)Enums.TaskStatus.Gonderildi, true); model = tskDB.BindTask(model, Guid.Parse(model.RecordId)); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } } else if (model.FromAddExplanationButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { tskDB.UpdateExplanation(model, Guid.Parse(model.RecordId)); model = tskDB.BindTask(model, Guid.Parse(model.RecordId)); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { if (model.task_user_id != BaseDB.SessionContext.Current.ActiveUser.UserUid.ToString() && model.assigned_user_id == BaseDB.SessionContext.Current.ActiveUser.UserUid.ToString()) { tskDB.UpdateTaskStatus(model, Guid.Parse(model.RecordId), Convert.ToInt32(model.task_status_id), model.is_active); model = tskDB.BindTask(model, Guid.Parse(model.RecordId)); } else { model = tskDB.UpdateTask(model, recordId); model = tskDB.BindTask(model, Guid.Parse(model.RecordId)); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { tsk_tasks task = new tsk_tasks(); tskDB.AddTask(task, model); model.RecordId = task.task_id.ToString(); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } } return(View(model)); }
public ActionResult TaskReport(TaskReport model) { TaskRepository tskDB = RepositoryManager.GetRepository <TaskRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; model.activeUsers = gnlDB.GetActiveUsers(); DateTime startDate = DateTime.MinValue; DateTime endDate = DateTime.MaxValue; if (model.start_date != null && model.start_date.CompareTo(DateTime.MinValue) != 0 && model.start_date.ToString() != "") { startDate = Convert.ToDateTime(model.start_date); } if (model.end_date != null && model.end_date.CompareTo(DateTime.MinValue) != 0 && model.end_date.ToString() != "") { endDate = Convert.ToDateTime(model.end_date); } List <tsk_tasks_v> taskList = null; if (!string.IsNullOrEmpty(model.task_status_id)) { if (model.task_status_id == "0") { taskList = tskDB.GetTaskList(model.assigned_user_id, startDate, endDate); } else { taskList = tskDB.GetTaskListByStatusId(Convert.ToInt32(model.task_status_id), startDate, endDate, model.assigned_user_id); } } else { taskList = tskDB.GetTaskList(model.assigned_user_id, startDate, endDate); } model.taskStatus = tskDB.GetTaskStatusList(); ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Report/TaskReport.rdlc"; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("TaskReportDataSet", taskList)); reportViewer.Height = 450; reportViewer.Width = 1000; reportViewer.AsyncRendering = false; ViewBag.ReportViewer = reportViewer; return(View(model)); }
public ActionResult User(User model) { Guid recordId = Guid.Empty; GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; model.activeGroups = gnlDB.GetActiveGroups(); ModelState.Remove("start_date"); ModelState.Remove("end_date"); ModelState.Remove("is_active"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { gnlDB.DeleteUser(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { if (!string.IsNullOrEmpty(model.password)) { model.password = GlobalHelper.EncriptText(model.password.Trim()); } gnl_users userByEmail = new gnl_users(); userByEmail = gnlDB.GetUserByEmail(model.email.Trim()); if (userByEmail != null && userByEmail.user_id != recordId) { ViewBag.Success = false; ModelState.AddModelError("Error", Resources.GlobalResource.exists_user_email); } else { model = gnlDB.UpdateUser(model, recordId); if (!string.IsNullOrEmpty(model.password)) { ViewBag.ResultMessage = Resources.GlobalResource.transaction_success_with_password; } else { ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } } } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { gnl_users user = new gnl_users(); if (!string.IsNullOrEmpty(model.password)) { model.password = GlobalHelper.EncriptText(model.password.Trim()); } gnl_users userByEmail = new gnl_users(); userByEmail = gnlDB.GetUserByEmail(model.email.Trim()); if (userByEmail != null) { ViewBag.Success = false; ModelState.AddModelError("Error", Resources.GlobalResource.exists_user_email); } else { gnlDB.AddUser(user, model); model.RecordId = user.user_id.ToString(); if (!string.IsNullOrEmpty(model.password)) { ViewBag.ResultMessage = Resources.GlobalResource.transaction_success_with_password; } else { ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } } } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } if (string.IsNullOrEmpty(model.ManagerName)) { model.ManagerId = null; } if (!string.IsNullOrEmpty(model.ManagerId) && GlobalHelper.IsGuid(model.ManagerId)) { gnl_users userManager = gnlDB.GetUser(Guid.Parse(model.ManagerId)); if (userManager != null) { model.ManagerName = userManager.name + " " + userManager.surname; } } } return(View(model)); }
public ActionResult Projects(string RecordId, string MenuId) { CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); Project model = new Project(); #region Ortak Set Edilecek Değerler MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; #endregion Guid recordId = Guid.Empty; model.activeKurumlar = crmDB.GetKurumList(); model.activeBireyler = crmDB.GetBireyList(); model.activeBireylerKurumlar = crmDB.GetBireyKurumList(); model.activeUsers = gnlDB.GetActiveUsers(); model.projectTypes = crmDB.GetProjectTypeList(); model.kurum_id = Guid.Empty.ToString(); model.birey_id = Guid.Empty.ToString(); model.project_type_id = "1"; if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = crmDB.BindProject(model, recordId); if (model.birey_id != null && GlobalHelper.IsGuidOrEmpty(model.birey_id)) { model.birey_id = model.birey_id.ToString(); } if (model.kurum_id != null && GlobalHelper.IsGuidOrEmpty(model.kurum_id)) { model.kurum_id = model.kurum_id.ToString(); } if (model.statik != null && GlobalHelper.IsGuidOrEmpty(model.statik)) { model.statik = model.statik.ToString(); } if (model.mekanik != null && GlobalHelper.IsGuidOrEmpty(model.mekanik)) { model.mekanik = model.mekanik.ToString(); } if (model.elektrik != null && GlobalHelper.IsGuidOrEmpty(model.elektrik)) { model.elektrik = model.elektrik.ToString(); } if (model.harita != null && GlobalHelper.IsGuidOrEmpty(model.harita)) { model.harita = model.harita.ToString(); } if (model.yapi_denetim != null && GlobalHelper.IsGuidOrEmpty(model.yapi_denetim)) { model.yapi_denetim = model.yapi_denetim.ToString(); } if (model.isveren_mobil_phone != null) { model.isveren_mobil_phone = model.isveren_mobil_phone.ToString(); } if (model.proje_metrekare != null && !string.IsNullOrEmpty(model.proje_metrekare.ToString())) { model.proje_metrekare = model.proje_metrekare; model.proje_metrekare = model.proje_metrekare.Replace(',', '.'); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } return(View(model)); }