コード例 #1
0
        public ActionResult AddEditState(int id = 0, int pid = 0)
        {
            CustomMethods.ValidateRoles("State");
            if (!Convert.ToBoolean(Session["IsAdd"]) && !Convert.ToBoolean(Session["IsEdit"]))
            {
                return(View("ErrorPage", "Error"));
            }
            StateModel StateModel = new StateModel();
            int        take       = 10;
            int        skip       = take * pid;

            StateModel.PageID  = pid;
            StateModel.Current = pid + 1;
            ViewBag.c          = StateModel.PageID;
            if (id != 0)
            {
                var objstate = new StateBLL {
                }.GetSubStateById(id);
                if (objstate != null)
                {
                    StateModel.StateId   = objstate.StateId;
                    StateModel.StateName = objstate.StateName;
                    StateModel.CountryId = objstate.CountryId;
                    StateModel.IsActive  = Convert.ToBoolean(objstate.IsActive);
                }
            }
            CustomMethods.BindCountryList(StateModel);
            return(View(StateModel));
        }
コード例 #2
0
ファイル: StateDAL.cs プロジェクト: Ramkendre/Mycity
    public int DALStateInsert(StateBLL st)
    {
        using (SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]))
        {
            try
            {
                SqlParameter[] par = new SqlParameter[3];
                par[0]           = new SqlParameter("@stateName", st.stateName);
                par[1]           = new SqlParameter("@countryId", st.countryId);
                par[2]           = new SqlParameter("@status", 100);
                par[2].Direction = ParameterDirection.Output;

                SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "spStateInsert", par);

                status = (int)par[2].Value;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
        return(status);
    }
コード例 #3
0
    public bool BLLIsExistStateName(StateBLL st)
    {
        bool flag = false;

        flag = stateDALObj.DALIsExistCountryName(st);
        return(flag);
    }
コード例 #4
0
ファイル: StateDAL.cs プロジェクト: Ramkendre/Mycity
    public bool DALIsExistCountryName(StateBLL st)
    {
        bool   flag = false;
        string row  = "";

        using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]))
        {
            try
            {
                SqlParameter[] par = new SqlParameter[2];
                par[0]           = new SqlParameter("@stateName", st.stateName);
                par[1]           = new SqlParameter("@Status", 11);
                par[1].Direction = ParameterDirection.Output;
                row = Convert.ToString(SqlHelper.ExecuteScalar(con, CommandType.StoredProcedure, "spStateIsExistByName", par));
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }

            if (row != "")
            {
                flag = true;
            }
            return(flag);
        }
    }
コード例 #5
0
        public ActionResult ViewState(int id = 0, int pid = 0)
        {
            CustomMethods.ValidateRoles("State");
            if (!Convert.ToBoolean(Session["IsAdd"]) && !Convert.ToBoolean(Session["IsEdit"]))
            {
                return(View("ErrorPage", "Error"));
            }
            StateModel state = new StateModel();
            int        take  = 10;
            int        skip  = take * pid;

            state.PageID  = pid;
            state.Current = pid + 1;
            ViewBag.c     = state.PageID;
            if (id != 0)
            {
                var objState = new StateBLL {
                }.GetSubStateById(id);
                if (objState != null)
                {
                    state.StateId     = objState.StateId;
                    state.StateName   = objState.StateName;
                    state.CountryId   = objState.CountryId; //== null ? 0 : Convert.ToInt32(objcourse.CountryId);
                    state.CountryName = objState.CountryName;
                    state.IsActive    = Convert.ToBoolean(objState.IsActive);
                }
            }
            return(View(state));
        }
コード例 #6
0
        public JsonResult ChangeStateStatus(int id)
        {
            bool Result = false;
            bool changestatus = new StateBLL {
            }.ChangeStatus(id);

            if (changestatus)
            {
                Result = true;
            }
            return(Json(Result));
        }
コード例 #7
0
        public ActionResult State(string SearchValue, string sortOrder, int pid = 0, int cid = 0)
        {
            int        take  = 10;
            int        skip  = take * pid;
            StateModel model = new StateModel();

            model.PageID  = pid;
            model.Current = pid + 1;
            IEnumerable <StateModel> Courses = new List <StateModel>();

            CustomMethods.ValidateRoles("State");
            var Citieslist = new StateBLL {
            }.GetAllState(skip, take);

            if (cid != 0)
            {
                var sortedlist = new StateBLL {
                }.GetAllState(skip, take, cid);
                double count = Convert.ToDouble(sortedlist.Count);
                var    res   = count / take;
                model.Pagecount = (int)Math.Ceiling(res);
                model.StateList = sortedlist.Select(x => new StateModel
                {
                    CountryId   = x.CountryId,
                    CountryName = x.CountryName,
                    StateId     = x.StateId,
                    StateName   = x.StateName,
                    IsActive    = Convert.ToBoolean(x.IsActive)
                }).ToList();
            }
            else
            {
                if (Citieslist != null)
                {
                    double count = Convert.ToDouble(new StateBLL {
                    }.GetPageCount());
                    var res      = count / take;
                    model.Pagecount = (int)Math.Ceiling(res);
                    model.StateList = Citieslist.Select(x => new StateModel
                    {
                        CountryId   = x.CountryId,
                        CountryName = x.CountryName,
                        StateId     = x.StateId,
                        StateName   = x.StateName,
                        IsActive    = Convert.ToBoolean(x.IsActive)
                    }).ToList();
                }
            }

            return(View(model));
        }
コード例 #8
0
        public void LoadState()
        {
            StateBLL  state    = new StateBLL();
            DataTable dtstates = new DataTable();

            dtstates = state.LoadState();

            ddlState.DataSource     = dtstates;
            ddlState.DataTextField  = "Name";
            ddlState.DataValueField = "ID_State";
            ddlState.DataBind();

            ddlState.Items.Insert(0, new ListItem("-----Select State-----", "0"));
        }
コード例 #9
0
    public bool BLLIsExistState(StateBLL st)
    {
        bool flag = false;
        int  i;

        flag = stateDALObj.DALIsExistState(st);
        if (flag == false)
        {
            i = stateDALObj.DALStateUpdate(st);
            if (i == 0)
            {
                flag = true;
            }
        }
        return(flag);
    }
コード例 #10
0
 public static void BindStateList <T>(T model)
 {
     try
     {
         var cities = new StateBLL {
         }.GetAllState();
         if (cities != null)
         {
             model.GetType().GetProperty("StateList").SetValue(model, cities.Select(x => new SelectListItem {
                 Value = x.StateId.ToString(), Text = x.StateName
             }));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #11
0
ファイル: ClaimController.cs プロジェクト: ezetrivium/MUSICGO
        public IHttpActionResult Post(ClaimViewModel claimViewModel)
        {
            try
            {
                var    identityClaims = (ClaimsIdentity)HttpContext.Current.User.Identity;
                string userObj        = identityClaims.FindFirst("userObject").Value;
                var    userLogged     = JsonConvert.DeserializeObject <UserBE>(userObj);
                var    uvm            = Mapper.Map <UserBE, UserViewModel>(userLogged);

                claimViewModel.User = uvm;

                StateBLL stateBLL = new StateBLL();

                var states = stateBLL.Get();

                claimViewModel.State = states.Where(s => s.Name == "pending").First();

                var result = this.claimBLL.Add(claimViewModel);

                if (result == Guid.Empty)
                {
                    throw new BusinessException(Messages.ErrorAddClaim);
                }

                var response = Request.CreateResponse(System.Net.HttpStatusCode.OK, Messages.SuccessfulUperationCrud);

                return(this.ResponseMessage(response));
            }
            catch (BusinessException ex)
            {
                var response = Request.CreateResponse(System.Net.HttpStatusCode.InternalServerError, ex.Message);
                return(this.ResponseMessage(response));
            }
            catch (Exception ex)
            {
                var response = Request.CreateResponse(System.Net.HttpStatusCode.InternalServerError, Messages.Generic_Error);
                return(this.ResponseMessage(response));
            }
        }
コード例 #12
0
ファイル: StateDAL.cs プロジェクト: Ramkendre/Mycity
    public DataTable DALStateSelectBySId(StateBLL st)
    {
        using (SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]))
        {
            try
            {
                SqlParameter[] par = new SqlParameter[1];
                par[0] = new SqlParameter("@stateId", st.stateId);

                ds = SqlHelper.ExecuteDataset(con, CommandType.StoredProcedure, "spStateSelectBySId", par);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
        return(ds.Tables[0]);
    }
コード例 #13
0
        public ActionResult AddEditState(StateModel model)
        {
            int      result   = 0;
            StateBLL StateBLL = new StateBLL();

            try
            {
                if (model.StateId == 0)
                {
                    if (!Convert.ToBoolean(Session["IsAdd"]))
                    {
                        return(View("ErrorPage"));
                    }
                }
                else
                {
                    if (!Convert.ToBoolean(Session["IsEdit"]))
                    {
                        return(View("ErrorPage"));
                    }
                }
                if (ModelState.IsValid)
                {
                    if (model.StateId == 0)
                    {
                        var checkDuplicate = objdb.States.Where(x => x.StateName == model.StateName).FirstOrDefault();
                        if (checkDuplicate == null)
                        {
                            int res = new StateBLL {
                            }.AddEditState(new StateModel
                            {
                                StateName = model.StateName,
                                CountryId = model.CountryId,
                                IsActive  = model.IsActive,
                                CreatedBy = Convert.ToInt32(Session["UserId"]),
                            });
                            if (res != 0)
                            {
                                Session["Success"] = "Successfully Added The Record";
                                return(RedirectToAction("State"));
                            }
                        }
                        Session["Error"] = "Record Already Exists";
                        return(RedirectToAction("AddEditState"));
                    }


                    else
                    {
                        model.UpdatedBy = Convert.ToInt32(Session["UserId"]);
                        result          = StateBLL.AddEditState(model);

                        if (result != 0)
                        {
                            Session["Success"] = "Successfully Updated The Record";
                            return(RedirectToAction("State"));
                        }
                    }
                }
                CustomMethods.BindCountryList(model);
                return(View(model));
            }
            catch (Exception)
            {
                Session["Error"] = "An Error has occured";
                CustomMethods.BindCountryList(model);
                return(View(model));

                throw;
            }
        }
コード例 #14
0
    public DataTable BLLGetSelectedState(StateBLL st, int i)
    {
        DataTable dtStateSelectByCId = stateDALObj.DALStateSelectByCId(st, i);

        return(dtStateSelectByCId);
    }
コード例 #15
0
 public int BLLStateInsert(StateBLL st)
 {
     status = stateDALObj.DALStateInsert(st);
     return(status);
 }
コード例 #16
0
 public int BLLStateUpdate(StateBLL st)
 {
     status = stateDALObj.DALStateUpdate(st);
     return(status);
 }
コード例 #17
0
ファイル: StateController.cs プロジェクト: ezetrivium/MUSICGO
 public StateController()
 {
     this.stateBLL = new StateBLL();
 }