private void LoadDataSecdetails() { try { txt_Customer_name.Text = findExisting.FindExisitingUSer(txt_userx.Text); DataTable dtccc = new DataTable(); dtccc = new u_UserRights_DL().GetUserRightsSecCenter(txt_userx.Text.Trim()); dtxRights = new u_UserRights_DL().GetUserRightsSecCenter(txt_userx.Text.Trim()); //dataGridView3.DataSource = dtccc; dataGridView2.DataSource = dtxRights; dataGridView2.Columns[0].Width = 70; dataGridView2.Columns[1].Width = 120; dataGridView2.Columns[2].Width = 60; dataGridView2.Columns[3].Width = 60; dataGridView2.Columns[4].Width = 60; dataGridView2.Columns[5].Width = 60; dataGridView2.Columns[6].Width = 60; //dataGridView1.Columns[6].DefaultCellStyle.ForeColor = Color.Green; dataGridView2.Refresh(); } catch (Exception ex) { LogFile.WriteErrorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, this.Name, ex.Message.ToString(), "Exception"); commonFunctions.SetMDIStatusMessage("Genaral Error on loading data", 1); } }
/// <summary> /// Call the GetUserRoleRightsToUserID method in the data Access Layer /// </summary> /// <param name="objURight">Object of a u_UserRights class in smartOffice_Models</param> /// <returns>DataTable filled with user rights</returns> public DataTable GetUserRoleRightsToUserID(u_UserRights objURight) { try { u_UserRights_DL objURightDL = new u_UserRights_DL(); DataTable dtUserRights = objURightDL.GetUserRoleRightsToUserID(objURight); return(CreateDataTable(dtUserRights)); } catch (Exception ex) { throw ex; } }
/*FunctionButtonStatus Was created by Asanga Chandrakumara on 12:18 PM 6/24/2015*/ /// <summary> /// THis function will enable and disable the button status as required /// </summary> /// <param name="typex">Enumaration to function type</param> public void FunctionButtonStatus(xEnums.PerformanceType typex) { u_UserRights_DL inspection = commonFunctions.GetUserRightObj("A0051", commonFunctions.Loginuser.Trim()); u_UserRights_DL dispatch = commonFunctions.GetUserRightObj("A0052", commonFunctions.Loginuser.Trim()); u_UserRights_DL handover = commonFunctions.GetUserRightObj("A0053", commonFunctions.Loginuser.Trim()); u_UserRights_DL confirmation = commonFunctions.GetUserRightObj("A0054", commonFunctions.Loginuser.Trim()); switch (typex) { case xEnums.PerformanceType.Default: btn_process.Enabled = inspection.boolAccess; btn_dispatchdo.Enabled = dispatch.boolAccess; btn_hanoverdo.Enabled = handover.boolAccess; btn_confirmdelivery.Enabled = confirmation.boolAccess; break; } //dataGridView1.Enabled = true; //txt_IDX.Enabled = true; }
/// <summary> /// Save the Data By accessing the Data Access Layer /// </summary> /// <param name="objUserRight">Object of a u_UserRights class in smartOffice_Models</param> /// <returns>If saved Successfully,returns true, else false</returns> public bool SaveUserRights(u_UserRights objUserRight) { try { u_UserRights_DL objUserRightDL = new u_UserRights_DL(); if (objUserRightDL.ExistingUserRights(objUserRight) == false) { return(objUserRightDL.SaveUserRights(objUserRight)); } else { return(objUserRightDL.UpdateRights(objUserRight)); } } catch (Exception ex) { throw ex; } }
/*FunctionButtonStatus Was created by Asanga Chandrakumara on 12:18 PM 6/24/2015*/ /// <summary> /// THis function will enable and disable the button status as required /// </summary> /// <param name="typex">Enumaration to function type</param> public void FunctionButtonStatus(xEnums.PerformanceType typex) { u_UserRights objUserRight = new u_UserRights(); objUserRight.User = new u_User(); objUserRight.MenuTag = new u_MenuTag(); objUserRight.User.strUserID = Globals.g_strUser; objUserRight.MenuTag.strMenuID = formID.Trim(); u_UserRights_DL objURightDL = new u_UserRights_DL(); u_UserRights_DL dtAllMenuItems = objURightDL.GetUserRightsForOneMenu(objUserRight); switch (typex) { case xEnums.PerformanceType.Save: if (dtAllMenuItems.boolCreate == false) { btn_new.Enabled = false; btn_cancel.Enabled = false; btn_save.Enabled = false; btn_delete.Enabled = dtAllMenuItems.boolDelete; btn_edit.Enabled = false; btn_print.Enabled = dtAllMenuItems.boolPrint; //dataGridView1.Enabled = true; //txt_IDX.Enabled = true; } else { btn_cancel.Enabled = false; btn_save.Enabled = false; btn_new.Enabled = true; btn_delete.Enabled = dtAllMenuItems.boolDelete; btn_edit.Enabled = false; btn_print.Enabled = dtAllMenuItems.boolPrint; //dataGridView1.Enabled = true; //txt_IDX.Enabled = true; } break; case xEnums.PerformanceType.Delete: //when press the delete button if (dtAllMenuItems.boolCreate == false) { btn_new.Enabled = false; } else { btn_cancel.Enabled = false; btn_save.Enabled = false; btn_new.Enabled = true; btn_delete.Enabled = false; btn_edit.Enabled = false; btn_print.Enabled = false; } break; case xEnums.PerformanceType.Existing: //enter existing item to system if (dtAllMenuItems.boolCreate == false) { btn_new.Enabled = false; } else { btn_cancel.Enabled = true; btn_save.Enabled = false; btn_new.Enabled = false; btn_delete.Enabled = dtAllMenuItems.boolDelete; btn_edit.Enabled = false; btn_print.Enabled = dtAllMenuItems.boolPrint; } break; case xEnums.PerformanceType.Edit: //enter existing item to system and press edit if (dtAllMenuItems.boolCreate == false) { btn_new.Enabled = false; btn_cancel.Enabled = true; btn_save.Enabled = true; btn_new.Enabled = dtAllMenuItems.boolCreate; btn_delete.Enabled = dtAllMenuItems.boolDelete; btn_edit.Enabled = false; btn_print.Enabled = dtAllMenuItems.boolPrint; // dataGridView1.Enabled = false; //txt_IDX.Enabled = false; } else { btn_cancel.Enabled = true; btn_save.Enabled = true; btn_new.Enabled = false; btn_delete.Enabled = false; btn_edit.Enabled = false; btn_print.Enabled = false; //dataGridView1.Enabled = false; //txt_IDX.Enabled = false; } break; case xEnums.PerformanceType.Exit: break; case xEnums.PerformanceType.New: if (dtAllMenuItems.boolCreate == false) { btn_new.Enabled = false; dataGridView1.Enabled = false; //txt_IDX.Enabled = false; } else { btn_cancel.Enabled = true; btn_save.Enabled = true; btn_new.Enabled = false; btn_delete.Enabled = false; btn_edit.Enabled = false; btn_print.Enabled = false; //dataGridView1.Enabled = false; //txt_IDX.Enabled = false; } break; case xEnums.PerformanceType.Default: if (dtAllMenuItems.boolCreate == false) { btn_new.Enabled = false; btn_delete.Enabled = dtAllMenuItems.boolDelete; btn_edit.Enabled = false; btn_print.Enabled = dtAllMenuItems.boolPrint; btn_save.Enabled = false; btn_cancel.Enabled = false; //dataGridView1.Enabled = true; //txt_IDX.Enabled = true; } else { btn_cancel.Enabled = false; btn_save.Enabled = false; btn_new.Enabled = true; btn_delete.Enabled = dtAllMenuItems.boolDelete; btn_edit.Enabled = false; btn_print.Enabled = dtAllMenuItems.boolPrint; //dataGridView1.Enabled = true; //txt_IDX.Enabled = true; } break; case xEnums.PerformanceType.Cancel: if (dtAllMenuItems.boolCreate == false) { btn_new.Enabled = false; dataGridView1.Enabled = true; //txt_IDX.Enabled = true; } else { btn_cancel.Enabled = false; btn_save.Enabled = false; btn_new.Enabled = false; btn_delete.Enabled = false; btn_edit.Enabled = false; btn_print.Enabled = false; dataGridView1.Enabled = true; //txt_IDX.Enabled = true; } break; } }