Esempio n. 1
0
        public DeleteRegAccountReturn DeleteRegAccount(DeleteRegAccount deleteRegAccount)
        {
            DeleteRegAccountReturn deleteRegAccountReturn = new DeleteRegAccountReturn();

            try
            {
                this._IsSuccess = true;
                this.SpName     = DL_StoreProcedure.SP_DHS_DeleteRegAccount; //Sp Name
                SqlParameter[] param = new SqlParameter[2];
                param[0] = new SqlParameter("@UserId", deleteRegAccount.UserId);
                param[1] = new SqlParameter("@TblId", deleteRegAccount.Id);

                ds = db.GetDataSet(this.SpName, param);
                if (ds != null && ds.Tables.Count > 0)
                {
                    //ds.Tables
                    //var Json = JsonConvert.SerializeObject(ds.Tables[0].Rows[0]);
                    deleteRegAccountReturn = new DeleteRegAccountReturn()
                    {
                        Status = ds.Tables[0].Rows[0]["Status"].ToString()
                    };
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog(LogLevelL4N.ERROR, "Exception : " + ex.Message);
                _IsSuccess = false;
            }
            return(deleteRegAccountReturn);
        }
        public HttpResponseMessage DeleteRegisteredAccount(HttpRequestMessage req, DeleteRegAccount deleteRegAccount)
        {
            User user = new User()
            {
                Password = deleteRegAccount.Key, UserId = deleteRegAccount.UserId
            };

            Validation.UserCheck(user);
            if (Validation._IsSuccess)
            {
                BL_Operator            op = new BL_Operator();
                DeleteRegAccountReturn deleteRegAccountReturn = op.DeleteRegAccount(deleteRegAccount);
                if (op._IsSuccess)
                {
                    return(req.CreateResponse <DeleteRegAccountReturn>(HttpStatusCode.OK, deleteRegAccountReturn));
                }
                else
                {
                    return(req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError"));
                }
            }
            return(req.CreateErrorResponse(HttpStatusCode.Unauthorized, "Unauthorized"));
        }