public DelegationMasterDTO SaveDetails(DelegationMasterDTO m_objDelegationMasterDTO, int m_nPartialSave, string sConnectionString, int nLoggedInUserId) { try { //InsiderTradingDAL.DelegationMasterDAL objDelegationMasterDAL = new InsiderTradingDAL.DelegationMasterDAL(); using (var objDelegationMasterDAL = new InsiderTradingDAL.DelegationMasterDAL()) { return(objDelegationMasterDAL.SaveDetails(m_objDelegationMasterDTO, m_nPartialSave, sConnectionString, nLoggedInUserId)); } } catch (Exception e) { throw e; } }
public DelegationMasterDTO GetDetails(DelegationMasterDTO m_objDelegationMasterDTO, string sConnectionString) { try { //InsiderTradingDAL.DelegationMasterDAL objDelegationMasterDAL = new InsiderTradingDAL.DelegationMasterDAL(); using (var objDelegationMasterDAL = new InsiderTradingDAL.DelegationMasterDAL()) { return(objDelegationMasterDAL.GetDetails(m_objDelegationMasterDTO, sConnectionString)); } } catch (Exception e) { throw e; } }
public ActionResult Create(DelegateModel objDelegateModel, int acid) { LoginUserDetails objLoginUserDetails = null; DelegationMasterDTO objDelegationMasterDTO = null; try { objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); if (Convert.ToInt32(objDelegateModel.DelegationId) != 0) { objDelegationMasterDTO = new DelegationMasterDTO(); objDelegationMasterDTO.DelegationId = Convert.ToInt32(objDelegateModel.DelegationId); using (DelegationMasterSL objDelegationMasterSL = new DelegationMasterSL()) { objDelegationMasterDTO = objDelegationMasterSL.GetDetails(objDelegationMasterDTO, objLoginUserDetails.CompanyDBConnectionString); InsiderTrading.Common.Common.CopyObjectPropertyByName(objDelegationMasterDTO, objDelegateModel); } } GenerateDelegationDetails(Convert.ToInt32(objDelegateModel.DelegationId), Convert.ToInt32(objDelegateModel.UserInfoIdFrom), Convert.ToInt32(objDelegateModel.UserInfoIdTo)); ViewBag.user_action = acid; return(View("Edit", objDelegateModel)); } catch (Exception e) { string sErrMessage = Common.Common.getResource(e.InnerException.Data[0].ToString()); ModelState.AddModelError("error", sErrMessage); return(View("Edit", objDelegateModel)); } finally { objLoginUserDetails = null; objDelegationMasterDTO = null; } }
public JsonResult Index(DelegateModel objDelegateModel, int acid) { bool bStatusFlag = false; int nPatrialSave = 0; var ErrorDictionary = new Dictionary <string, string>(); Common.Common objCommon = new Common.Common(); LoginUserDetails objLoginUserDetails = null; try { if (!objCommon.ValidateCSRFForAJAX()) { return(Json(new { status = false, msg = ErrorDictionary }, JsonRequestBehavior.AllowGet)); } objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); if (ModelState.IsValid) { ViewBag.UserInfoIdFrom = objDelegateModel.UserInfoIdFrom; ViewBag.UserInfoIdTo = objDelegateModel.UserInfoIdTo; ViewBag.DelegationFrom = objDelegateModel.DelegationFrom; ViewBag.DelegationTo = objDelegateModel.DelegationTo; objDelegateModel.DelegationId = 0; DelegationMasterDTO objDelegationMasterDTO = new DelegationMasterDTO(); Common.Common.CopyObjectPropertyByName(objDelegateModel, objDelegationMasterDTO); using (DelegationMasterSL objDelegationMasterSL = new DelegationMasterSL()) { objDelegationMasterDTO = objDelegationMasterSL.SaveDetails(objDelegationMasterDTO, nPatrialSave, objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); bStatusFlag = true; ErrorDictionary.Add("id", Convert.ToString(objDelegationMasterDTO.DelegationId)); } } else { ErrorDictionary = GetModelStateErrorsAsString(); } }catch (Exception e) { ModelState.Remove("KEY"); ModelState.Add("KEY", new ModelState()); ModelState.Clear(); string sErrMessage = Common.Common.getResource(e.InnerException.Data[0].ToString()); ModelState.AddModelError("error", sErrMessage); ErrorDictionary = GetModelStateErrorsAsString(); } finally { objLoginUserDetails = null; } return(Json(new { status = bStatusFlag, msg = ErrorDictionary, user_action = acid })); }
public ActionResult Edit(int acid, int[] chkActivity, DelegateModel objDelegateModel) { int nPartialSave = 1; DataTable tblDelefationDetailsActivity = null; DelegationMasterDTO objDelegationMasterDTO = null; LoginUserDetails objLoginUserDetails = null; try { tblDelefationDetailsActivity = new DataTable("RoleActivityType"); tblDelefationDetailsActivity.Columns.Add(new DataColumn("RoleId", typeof(int))); tblDelefationDetailsActivity.Columns.Add(new DataColumn("ActivityId", typeof(int))); objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); objDelegationMasterDTO = new DelegationMasterDTO(); Common.Common.CopyObjectPropertyByName(objDelegateModel, objDelegationMasterDTO); using (DelegationMasterSL objDelegationMasterSL = new DelegationMasterSL()) { objDelegationMasterDTO = objDelegationMasterSL.SaveDetails(objDelegationMasterDTO, nPartialSave, objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); if (chkActivity != null && chkActivity.Length > 0) { DataRow row = null; foreach (int ActivityId in chkActivity) { row = tblDelefationDetailsActivity.NewRow(); row["RoleId"] = objDelegationMasterDTO.DelegationId; row["ActivityId"] = ActivityId; tblDelefationDetailsActivity.Rows.Add(row); } row = null; } if (chkActivity != null && chkActivity.Length > 0) { objDelegationMasterSL.DelegationDetailsSaveDelete(objLoginUserDetails.CompanyDBConnectionString, tblDelefationDetailsActivity, objLoginUserDetails.LoggedInUserID); } } // TODO: Add insert logic here // return RedirectToAction("Edit", "Delegate", new { id = id }); return(RedirectToAction("index", "Delegate", new { acid = ConstEnum.UserActions.DELEGATION_MASTER_VIEW })); } catch (Exception e) { GenerateDelegationDetails(Convert.ToInt32(objDelegateModel.DelegationId), Convert.ToInt32(objDelegateModel.UserInfoIdFrom), Convert.ToInt32(objDelegateModel.UserInfoIdTo)); string sErrMessage = Common.Common.getResource(e.InnerException.Data[0].ToString()); ModelState.AddModelError("error", sErrMessage); return(View("Edit", objDelegateModel)); } finally { tblDelefationDetailsActivity = null; objDelegationMasterDTO = null; objLoginUserDetails = null; } }