Exemplo n.º 1
0
 /// <summary>
 /// Insert Role detail.
 /// </summary>
 /// <param name="object">Data that converted into xml format.</param>
 /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns>
 public int InsertAccess(RoleGadgetMappingBDto GadgetBdto)
 {
     Database db = null;
     DbCommand dbCmd = null;
     int Result = 0;
     try
     {
         db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
         dbCmd = db.GetStoredProcCommand(DALHelper.USP_GADGET_ACCESS_MAPPING_INSERT);
         db.AddInParameter(dbCmd, "@ROLE_ID", DbType.Int32, GadgetBdto.RoleID);
         db.AddInParameter(dbCmd, "@MODULE_ID", DbType.Int32, GadgetBdto.ModuleID);
         db.AddInParameter(dbCmd, "@GADGET_ID", DbType.Int32, GadgetBdto.GadgetID);
         db.AddInParameter(dbCmd, "@READ_ACCESS ", DbType.Boolean, GadgetBdto.ReadAccess);
         db.AddOutParameter(dbCmd, "@IS_INSERT", DbType.Int32, 1);
         db.ExecuteNonQuery(dbCmd);
         Result = Convert.ToInt32(db.GetParameterValue(dbCmd, "@IS_INSERT"));
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         {
             throw ex;
         }
     }
     finally
     {
         DALHelper.Destroy(ref dbCmd);
     }
     return Result;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Get AssignModule From RoleID
 /// </summary>
 /// <returns>Returns dataset contains module name data.</returns>
 public DataSet GetGadgetByRole(RoleGadgetMappingBDto GadgetBdto)
 {
     Database db = null;
     DbCommand dbCmd = null;
     DataSet ds = null;
     try
     {
         db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
         dbCmd = db.GetStoredProcCommand(DALHelper.USP_ROLE_GADGET_MAPPING_SELECT_BYROLE);
         db.AddInParameter(dbCmd, "@ROLE_ID", DbType.Int32, GadgetBdto.RoleID);
         ds = db.ExecuteDataSet(dbCmd);
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         {
             throw ex;
         }
     }
     finally
     {
         DALHelper.Destroy(ref dbCmd);
     }
     return ds;
 }
 /// <summary>
 /// Bind customer grid
 /// </summary>
 private void BindGridGadgetAccess(int RoleId)
 {
     DataSet ds = null;
     objRoleGadgetMappingDal = new RoleGadgetMappingDal();
     objRoleGadgetMappingBDto = new RoleGadgetMappingBDto();
     objRoleGadgetMappingBDto.RoleID = RoleId;
     ds = objRoleGadgetMappingDal.GetGadgetByRole(objRoleGadgetMappingBDto);
     radGridAccess.DataSource = ds;
     radGridAccess.DataBind();
 }
 protected void btnSave_OnClick(object sender, EventArgs e)
 {
     int result;
     bool SaveFail = true;
     objRoleGadgetMappingBDto = new RoleGadgetMappingBDto();
     objRoleGadgetMappingDal = new RoleGadgetMappingDal();
     foreach (GridDataItem item in radGridAccess.Items)
     {
         CheckBox chkRead = (CheckBox)item.FindControl("grdChkRead");
         if (item["GADGET_ID"] != null)
             objRoleGadgetMappingBDto.GadgetID = int.Parse(item["GADGET_ID"].Text);
         if (item["MODULE_ID"] != null)
             objRoleGadgetMappingBDto.ModuleID = int.Parse(item["MODULE_ID"].Text);
         if (GlobalRoleId != 0)
             objRoleGadgetMappingBDto.RoleID = GlobalRoleId;
         objRoleGadgetMappingBDto.ReadAccess = chkRead.Checked;
         result = objRoleGadgetMappingDal.InsertAccess(objRoleGadgetMappingBDto);
         if (result != 1)
             SaveFail = false;
     }
     if (SaveFail)
     {
         Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
         Master.MessageCssClass = "successMessage";
     }
     pnlAccessGrid.Visible = false;
 }