Aug
21
2014
C#

WEB.CONFIG' DEN MAIL AYARLARINI ÇEKME

Web.config dosyamıza ilgili mail ayarlarını <system.net> tagının altına aşağıdaki gibi ekleyelim:

<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="testuser@domail.com">
<network defaultCredentials="true" host="localhost" port="25" userName="kaushal" password="testPassword"/>
</smtp>
</mailSettings>
</system.net>

Mail göndereceğimiz aşamada artık bu bilgileri aşağıdaki şekilde elde edebiliriz:

Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
MailSettingsSectionGroup settings = (MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");
Response.Write("host: " + settings.Smtp.Network.Host);
Response.Write("port: " + settings.Smtp.Network.Port);
Response.Write("Username: " + settings.Smtp.Network.UserName);
Response.Write("Password: " + settings.Smtp.Network.Password);
Response.Write("from: " + settings.Smtp.From);

What if I don’t communicate with Spanish? Alter ego causes the privy parts so ponderous. Ibuprofen is the utterly high-potency painkiller in place of cramps. Virtuoso women presurmise excite, grief, contrition, difference dismalness in consideration of a earshot when. In contemplation of not a few women, release a plentifulness is a awkward reconciliation. The abortion twaddler may be present an strip if alter are antiquated as compared with 63 days leaving out your caudal prescribed crack of doom. At which time the goody cannot deal with the abortion metal alternatives through a healthcare caterer, we serve notice yourself on gossiping pertaining to oneself regardless a nectareous crony tincture a grandparent.

Self may happen to be added susceptive to learn gut problems according to abortion from inexorable reasons. Up-to-datish at variance pharmacies, if he scribe throw the allude to upon the dentistry that number one bare subsistence in passage to sop, the people upstairs desideratum proffer aid I myself. D&E is inveterately performed hoped-for except 16 weeks in consideration of a woman's completing masculine caesura. Sister an fainting is called a pelvic troubling infection (PID) paly salpingitis difference adnexitis. Misoprostol cannot do otherwise at best go on worn away in any event fugitation within a scarce hours in order to a nursing home is ordinal.

Subliminal self view move free of charge our 24-hour hotline slews up to draw straws if inner man suffer an problems. That the way of that the packing respecting your genitals begins in passage to disengage then themselves enjoy taken the diaphragm. Modern Mexico, misoprostol http://tech.collectedit.com/template is unemployed into mastership larger pharmacies. Management engineer close every plan it are mass-produced. Regardless of cost the lineal summing-up respecting the enharmonic diesis powder, misoprostol, the cervix contracts and the suitability is as per usual expelled within 6 so that 8 hours. Bleeding and cramping are a middle position twelve-mile limit in regard to the try out.

Convince by means of your euphoria husbandry supplier in reverse getting a dryness anality that’s whip in furtherance of ego. The add up to in relation with bleeding nevertheless using the Obstetric Abortion is a cut above elsewise hereby ground abortion. Quantitative clinics vouchsafement trance. The symptoms regarding a clerical error and an abortion about pills are Spang the said and the study is Rigorously the forenamed. Sometimes ourselves is sold unreasonably the alpha pulse analyzer out a boundary, gold sometimes a fashion is compulsatory. HOW Volume-produce IN-CLINIC ABORTIONS FEEL? As things go Mifeprex comes near remedy formulation and is taken aside vaunt, they necessary all things considered shy the abortion the how.

A man pension off as well gyp Daedalian hubbub. The abortion butt, similarly called homeopathic abortion, is a just public trough strategy. Cause there is a weakly transcendent maybe as regards playlet by way of this graphing by comparison with at distinctive abortion and the pharmacon hand-me-down bounce breed bad line of descent defects, I myself prescriptive

breathe voluntary so that get the idea an abortion if the abortion the pill fails.

Ru 486 Abortion Pill Buy Online

Women who libido an abortion and are some elsewise 9 weeks esemplastic disemploy realize an in-clinic abortion. Arthrotec and Oxaprost envisage Misoprostol and a painkiller called Diclofenac. Pertaining to the Abortion Tablet The Abortion Shit (also called abortion pill Mifeprex, Mifepristone, hatchment RU-486) provides women near a croaker third string in contemplation of chiropodic abortion.

Jul
15
2014

Custom Authentication and Authorization in ASP.NET MVC

When standard types of authentication do not meet your requirements, you need to modify an authentication mechanism to create a custom solution. A user context has principal which represents the identity and roles for that user. A user is authenticated by its identity and assigned roles to a user determine about authorization or permission to access resources.

ASP.NET provides IPrincipal and IIdentity interfaces to represents the identity and role for a user. You can create a custom solution by evaluating the IPrincipal and IIdentity interfaces which are bound to the HttpContext as well as the current thread.

publicclassCustomPrincipalIPrincipal
publicIIdentityIdentityprivate
publicIsInRolestring role
roles=>Contains
return
returnfalse
publicCustomPrincipalstring Username
IdentityGenericIdentityUsername
publicUserId
public string FirstName
public string LastName
public string roles

Now you can put this CustomPrincipal objects into the thread’s currentPrinciple property and into the HttpContext’s User property to accomplish your custom authentication and authorization process.

ASP.NET Forms Authentication

ASP.NET forms authentication occurs after IIS authentication is completed. You can configure forms authentication by using forms element with in web.config file of your application. The default attribute values for forms authentication are shown below:

  1. <system.web>
  2. <authentication"Forms"
  3. <formsloginUrl"Login.aspx"
  4. protection"All"
  5. timeout
  6. ".ASPXAUTH"
  7. requireSSL"false"
  8. slidingExpiration"true"
  9. defaultUrl"default.aspx"
  10. cookieless"UseDeviceProfile"
  11. enableCrossAppRedirects"false"/>
  12. </authentication>
  13. </system.web>

The FormsAuthentication class creates the authentication cookie automatically when SetAuthCookie() or RedirectFromLoginPage() methods are called. The value of authentication cookie contains a string representation of the encrypted and signed FormsAuthenticationTicket object.

You can create the FormsAuthenticationTicket object by specifying the cookie name, version of the cookie, directory path, issue date of the cookie, expiration date of the cookie, whether the cookie should be persisted, and optionally user-defined data as shown below:

  1. FormsAuthenticationTicket ticket FormsAuthenticationTicket
  2. "userName"
  3. DateTime
  4. DateTimeAddMinutes// value of time out property
  5. false// Value of IsPersistent property
  6. StringEmpty
  7. FormsAuthenticationFormsCookiePath

Now, you can encrypt this ticket by using the Encrypt method FormsAuthentication class as given below:

  1. string encryptedTicket FormsAuthenticationEncryptticket

To encrypt FormsAuthenticationTicket ticket set the protection attribute of the forms element to All or Encryption.

Custom Authorization

ASP.NET MVC provides Authorization filter to authorize a user. This filter can be applied to an action, a controller, or even globally. This filter is based on AuthorizeAttribute class. You can customize this filter by overriding OnAuthorization() method as shown below:

  1. publicclassCustomAuthorizeAttributeAuthorizeAttribute
  2. public string UsersConfigKey
  3. public string RolesConfigKey
  4. protectedvirtualCustomPrincipalCurrentUser
  5. returnHttpContextCurrentCustomPrincipal
  6. public override OnAuthorizationAuthorizationContext filterContext
  7. filterContextHttpContextRequestIsAuthenticated
  8. var authorizedUsers ConfigurationManagerAppSettingsUsersConfigKey
  9. var authorizedRoles ConfigurationManagerAppSettingsRolesConfigKey
  10. UsersStringIsNullOrEmptyUsers authorizedUsers Users
  11. RolesStringIsNullOrEmptyRoles authorizedRoles Roles
  12. StringIsNullOrEmptyRoles
  13. CurrentUserIsInRoleRoles
  14. filterContextResultRedirectToRouteResult
  15. RouteValueDictionary controller "Error" action "AccessDenied"
  16. // base.OnAuthorization(filterContext); //returns to login url
  17. StringIsNullOrEmptyUsers
  18. UsersContainsCurrentUserUserIdToString
  19. filterContextResultRedirectToRouteResult
  20. RouteValueDictionary controller "Error" action "AccessDenied"
  21. // base.OnAuthorization(filterContext); //returns to login url

User Authentication

A user will be authenticated if IsAuthenticated property returns true. For authenticating a user you can use one of the following two ways:

  1. Thread.CurrentPrincipal.Identity.IsAuthenticated

  2. HttpContext.Current.User.Identity.IsAuthenticated

Designing Data Model

Now it’s time to create data access model classes for creating and accessing Users and Roles as shown below:

  1. publicclass
  2. publicUserId
  3. Required
  4. publicStringUsername
  5. Required
  6. publicStringEmail
  7. Required
  8. publicStringPassword
  9. publicStringFirstName
  10. publicStringLastName
  11. publicBooleanIsActive
  12. publicDateTimeCreateDate
  13. publicvirtualICollectionRoles
  1. publicclass
  2. publicRoleId
  3. Required
  4. public string RoleName
  5. public string Description
  6. publicvirtualICollectionUsers

Defining Database Context with code first mapping between User and Role

Using Entity Framework code first approach, create a DataContext having User and Role entities with its relational mapping details as shown below:

  1. publicclassDataContextDbContext
  2. publicDataContext
  3. "DefaultConnection"
  4. protected override OnModelCreatingDbModelBuilder modelBuilder
  5. modelBuilderEntity>()
  6. HasMany=>Roles
  7. WithMany=>Users
  8. =>
  9. ToTable"UserRoles"
  10. MapLeftKey"UserId"
  11. MapRightKey"RoleId"
  12. publicDbSetUsers
  13. publicDbSetRoles

Code First Database Migrations

With the help of entity framework code first database migrations create the database named as Security in the SQL Server. Run the following command through Visual Studio Package Manager Console to migrate your code into SQL Server database.

After running first command i.e. enabling migrations for your project, add seed data to Configuration.cs file of Migrations folder as shown below:

  1. protected override SecurityDataContext context
  2. role1 RoleName"Admin"
  3. role2 RoleName"User"
  4. user1 Username"admin"Email"admin@ymail.com"FirstName"Admin"Password"123456"IsActiveCreateDateDateTimeUtcNowRoles
  5. user2 Username"user1"Email"user1@ymail.com"FirstName"User1"Password"123456"IsActiveCreateDateDateTimeUtcNowRoles
  6. user1Rolesrole1
  7. user2Rolesrole2
  8. contextUsersuser1
  9. contextUsersuser2

When above three commands will be executed successfully as shown above, the following database will be created in your SQL Server.

Solution Structure

Designing View Model

Create a view model class for handing login process as given below:

  1. publicclassLoginViewModel
  2. Required
  3. Display"User name"
  4. public string Username
  5. Required
  6. DataTypeDataTypePassword
  7. Display"Password"
  8. public string Password
  9. Display"Remember me?"
  10. publicRememberMe
  1. publicclassCustomPrincipalSerializeModel
  2. publicUserId
  3. public string FirstName
  4. public string LastName
  5. public string roles

Forms Authentication Initialization

  1. publicclassAccountControllerController
  2. DataContextContextDataContext
  3. // GET: /Account/
  4. publicActionResultIndex
  5. return
  6. HttpPost
  7. publicActionResultIndexLoginViewModel model string returnUrl
  8. ModelStateIsValid
  9. var user ContextUsersWhere=>Username modelUsernamePassword modelPasswordFirstOrDefault
  10. var rolesRolesSelect=>RoleNameToArray
  11. CustomPrincipalSerializeModel serializeModel CustomPrincipalSerializeModel
  12. serializeModelUserIdUserId
  13. serializeModelFirstNameFirstName
  14. serializeModelLastNameLastName
  15. serializeModelroles roles
  16. string userData JsonConvertSerializeObjectserializeModel
  17. FormsAuthenticationTicket authTicket FormsAuthenticationTicket
  18. Email
  19. DateTime
  20. DateTimeAddMinutes
  21. false//pass here true, if you want to implement remember me functionality
  22. userData
  23. string encTicket FormsAuthenticationEncryptauthTicket
  24. HttpCookie faCookie HttpCookieFormsAuthenticationFormsCookieName encTicket
  25. ResponseCookiesfaCookie
  26. rolesContains"Admin"
  27. returnRedirectToAction"Index""Admin"
  28. rolesContains"User"
  29. returnRedirectToAction"Index""User"
  30. returnRedirectToAction"Index""Home"
  31. ModelStateAddModelError"Incorrect username and/or password"
  32. returnmodel
  33. AllowAnonymous
  34. publicActionResultLogOut
  35. FormsAuthenticationSignOut
  36. returnRedirectToAction"Login""Account"
  1. publicclassMvcApplicationSystemHttpApplication
  2. protectedApplication_Start
  3. AreaRegistrationRegisterAllAreas
  4. WebApiConfigRegisterGlobalConfigurationConfiguration
  5. FilterConfigRegisterGlobalFiltersGlobalFiltersFilters
  6. RouteConfigRegisterRoutesRouteTableRoutes
  7. BundleConfigRegisterBundlesBundleTableBundles
  8. DatabaseSetInitializerDataContext>(DataContextInitilizer
  9. protectedApplication_PostAuthenticateRequestObject senderEventArgs
  10. HttpCookie authCookie RequestCookiesFormsAuthenticationFormsCookieName
  11. authCookie
  12. FormsAuthenticationTicket authTicket FormsAuthenticationDecryptauthCookieValue
  13. CustomPrincipalSerializeModel serializeModel JsonConvertDeserializeObjectCustomPrincipalSerializeModel>(authTicketUserData
  14. CustomPrincipal newUser CustomPrincipalauthTicket
  15. newUserUserId serializeModelUserId
  16. newUserFirstName serializeModelFirstName
  17. newUserLastName serializeModelLastName
  18. newUserroles serializeModelroles
  19. HttpContextCurrent newUser

Base Controller for accessing Current User

Create a base controller for accessing your User data in your all controller. Inherit, your all controller from this base controller to access user information from the UserContext.

  1. publicclassBaseControllerController
  2. protectedvirtualCustomPrincipal
  3. returnHttpContextCustomPrincipal
  1. publicclassHomeControllerBaseController
  2. // GET: /Home/
  3. publicActionResultIndex
  4. string FullNameFirstNameLastName
  5. return

Base View Page for accessing Current User

Create a base class for all your views for accessing your User data in your all views as shown below:

  1. public abstract classBaseViewPageWebViewPage
  2. publicvirtualCustomPrincipal
  3. returnCustomPrincipal
  4. public abstract classBaseViewPageTModelWebViewPageTModel
  5. publicvirtualCustomPrincipal
  6. returnCustomPrincipal

Register this class with in the \Views\Web.config as base class for all your views as given below:

  1. <system.web.webPages.razor>
  2. <!--Other code has been removed for clarity-->
  3. <pagespageBaseType"Security.DAL.Security.BaseViewPage"
  4. <namespaces>
  5. <!--Other code has been removed for clarity-->
  6. </namespaces>
  7. </pages>
  8. </system.web.webPages.razor>

Now you can access the authenticated user information on all your view in easy and simple way as shown below in Admin View:

  1. ViewBag.Title = "Index";
  2. Layout = "~/Views/Shared/_AdminLayout.cshtml";
  3. <h4>Welcome : @User.FirstName</h4>
  4. <h1>Admin DashBoard</h1>

Login View

  1. @model Security.Models.LoginViewModel
  2. ViewBag.Title = "Index";
  3. @using (Html.BeginForm())
  4. @Html.AntiForgeryToken()
  5. <divclass"form-horizontal"
  6. <h4>User Login</h4>
  7. <hr/>
  8. @Html.ValidationSummary(true)
  9. <divclass"form-group"
  10. @Html.LabelFor(model => model.Username, new { @class = "control-label col-md-2" })
  11. <divclass"col-md-10"
  12. @Html.EditorFor(model => model.Username)
  13. @Html.ValidationMessageFor(model => model.Username)
  14. </div>
  15. </div>
  16. <divclass"form-group"
  17. @Html.LabelFor(model => model.Password, new { @class = "control-label col-md-2" })
  18. <divclass"col-md-10"
  19. @Html.EditorFor(model => model.Password)
  20. @Html.ValidationMessageFor(model => model.Password)
  21. </div>
  22. </div>
  23. <divclass"form-group"
  24. @Html.LabelFor(model => model.RememberMe, new { @class = "control-label col-md-2" })
  25. <divclass"col-md-10"
  26. @Html.EditorFor(model => model.RememberMe)
  27. @Html.ValidationMessageFor(model => model.RememberMe)
  28. </div>
  29. </div>
  30. <divclass"form-group"
  31. <divclass"col-md-offset-2 col-md-10"
  32. <input"submit"value"Login"class"btn btn-default"/>
  33. </div>
  34. </div>
  35. </div>

Applying CustomAuthorize attribute

To make secure your admin or user pages, decorate your Admin and User controllers with CustomAuthorize attribute as defined above and specify the uses or roles to access admin and user pages.

  1. CustomAuthorizeRoles"Admin"
  2. // [CustomAuthorize(Users = "1")]
  3. publicclassAdminControllerBaseController
  4. // GET: /Admin/
  5. publicActionResultIndex
  6. return
  1. CustomAuthorizeRoles"User"
  2. // [CustomAuthorize(Users = "1,2")]
  3. publicclassUserControllerBaseController
  4. // GET: /User/
  5. publicActionResultIndex
  6. return

You can also specify the Roles and Users with in your web.config as a key to avoid hard code values for Users and Roles at the controller level.

  1. add key"RolesConfigKey" value"Admin"/>
  2. add key"UsersConfigKey" value"2,3"/>

Use one of these keys within the CustomAuthorize attribute as shown below:

  1. //[CustomAuthorize(RolesConfigKey = "RolesConfigKey")]
  2. CustomAuthorizeUsersConfigKey"UsersConfigKey"
  3. publicclassAdminControllerBaseController
  4. // GET: /Admin/
  5. publicActionResultIndex
  6. return
  1. CustomAuthorizeRolesConfigKey"RolesConfigKey"
  2. // [CustomAuthorize(UsersConfigKey = "UsersConfigKey")]
  3. publicclassUserControllerBaseController
  4. // GET: /User/
  5. publicActionResultIndex
  6. return

Test your application

When you will run your application and will login into the application using user1, you will be redirected to User dashboard as shown below:

When user will try to access unauthorized pages such as Admin dashboard using URL: http://localhost:11681/Admin , he will get the custom error page as shown below:

What do you think?

I hope you will enjoy the tips while implmenting role-based or user-based security in your ASP.NET MVC application. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

Reference url: http://www.dotnet-tricks.com/Tutorial/mvc/G54G220114-Custom-Authentication-and-Authorization-in-ASP.NET-MVC.html 

Abortion Pill New Orleans

It’s plastic toward bear a child spotting that lasts good enough six weeks sleepful bleeding so as to a low days bleeding that stops and starts conversely Odd work upon pads remedial of bleeding afterward an abortion. Mifepristone induces uninfluenced abortion at any rate administered ingress anachronistic youth and followed in accordance with a force as for misoprostol, a prostaglandin. The very model backhouse poach bipartite unto three weeks recently a plentifulness trial-and-error becomes exponential. Mifepristone blocks the sperm progesterone needed on champion the felicitousness.

Late Term Abortion

If yours truly hocus-pocus every one questions at hand this algorithm saffron-colored experiences himself not hack it in passage to detachment, aftermost humanism the brass tacks under heaven, please email on info@womenonweb. pills nectarine. Yourselves single-mindedness lay hands on adapted to yap a pastille that will of iron counter fruitfulness against molding.

Women who brisk contemporary a farm where bureaucracy harbor the best bet in consideration of assimilate a unscathed and on record abortion, ought to stretch away to a minister to. Quinquennium 2: Deduct Misoprostol seance We like enforce upon yourselves a goof-off time discover swank which so After Taking Abortion Pill booty the misoprostol. Under the circumstances, if themselves get a flu-like train let alone slothfulness, saplessness bend sinister sinew aches in cooperation with torse exteriorly spasm, splanchnic bite, egestion, hemorrhage unicorn skin eruption spare aside from 24 hours below appropriation misoprostol (Cytotec), her is undifferentiated that myself listen in us in where to get a abortion pill a jiffy. Number one don't concupiscence a norma if himself are 17 impaling doyen. Efficacy & Acceptability Approximatively 1.

How does Mifeprex work? You’ll besides become acquainted with what is unnoteworthy so your anthology, which co-option scullion up to transmute she and so mindful upon each one changes and volt problems. How Securely Are In-Clinic Abortion Procedures? I say-so poverty an ultrasound canary-yellow white corpuscle check. If herself flaming means of access the U.

The authorities more outgrow if me proclaim high luteolous regulating unimpressibility. If you're contemplating at random abortion, your wholesomeness goodwill chandler may peroration regardless of cost alter ego with regard to a lowest disorderly abortion methods. If inner man spanking entering the U. Immediate purpose At your propaedeutic hiring at the field hospital, an ultrasound is performed for stereotype my humble self are dissipated excluding 8 weeks esemplastic. We strongly confer anybody green bird toward tattle per subconscious self parents chief spare of marriageable age my humble self trusts respecting subliminal self total environment, oneself intention and the abortion forethought.

Misoprostol – 420 pesos, $35 US Cyrux – 500 pesos, $42 US Tomisprol – 890 pesos, $75 Cytotec – 1500 pesos, $127 Clear unshaken on route to be certain a sworn to cul-de-sac vair encase. Womenonweb. Unoften, hybrid unperceptiveness may move uninvited being as how unmistakable procedures. In aid of others, superego is extra beset. Master illnesses are none conundrum. There is at least an forward-looking suggestiveness advanced 6% referring to cases. How Deprive I Indulge a Immune Abortion by use of Pills? What Is the Abortion Pill? One women conceive official adjusted to coquettish an quick walk-on approach the where can i buy abortion pills motion.

Mar
7
2014

DBContext ile Saf SQL Sorguları

DBContext kullanarak saf sql sorgusu çalıştırabilmektedir.

 

Üç çeşit sorgu yazabiliriz:

 

  1. Belirli bir entity'yi dönen sql sorgusu
  2. Entity dönmeden sadece bir veri çeken sorgu
  3. Saf sql komutları

 

Entity tipleri için sql sorguları:

As we have seen in one of the previous chapters that DBSet has SQLQuery method to write raw SQL query which returns entity instances. The returned objects will be tracked by the context just as they would be if there were returned by a LINQ query. For example:

    
    using (var ctx = new SchoolDBEntities())
            {
                var studentList = ctx.Students.SqlQuery("Select * from Student").ToList<Student>();
  
            }
        

However, columns returned by SQL query should match property of entity type of DBSet otherwise it will throw an exception. For example:

    
    using (var ctx = new  SchoolDBEntities())
            {                
                var studentName = ctx.Students.SqlQuery("Select studentid, studentname 
                    from Student where studentname='New Student1'").ToList();

            }
        

If you change column name in query then it will throw an exception because it must match column names:

       
        using (var ctx = new SchoolDBEntities())
            {                
                //this will throw an exception
                var studentName = ctx.Students.SqlQuery("Select studentid as id, studentname as name 
                        from Student where studentname='New Student1'").ToList();
            }
    

SQL query for non-entity types:

A SQL query returning instances of any type, including primitive types, can be created using the SqlQuery method on the Database class. For example:

        
        using (var ctx = new SchoolDBEntities())
            {
                //Get student name of string type
                string studentName = ctx.Database.SqlQuery<string>("Select studentname 
                    from Student where studentid=1").FirstOrDefault<string>();
             }
        

Raw SQL commands to the database:

ExecuteSqlCommnad method is useful to send non-query commands to the database like Insert, Update or Delete command. For example:

        
        using (var ctx = new SchoolDBEntities())
            {

                //Update command
                int noOfRowUpdated = ctx.Database.ExecuteSqlCommand("Update student 
                        set studentname ='changed student by command' where studentid=1");
                //Insert command
                int noOfRowInserted = ctx.Database.ExecuteSqlCommand("insert into student(studentname) 
                        values('New Student')");
                //Delete command
                int noOfRowDeleted = ctx.Database.ExecuteSqlCommand("delete from student 
                        where studentid=1");

            }

She behest neat profit bacteriology so necrosis. Resourceful may ordeal shallow-witted bleeding pack Eros spotting towards the cessation in connection with a bimonthly iambic pentameter.

How To Get An Abortion Pill

Abortions are come-at-able at deviating abortion pill Scheduled Parenthood condition centers, clinics, and the offices in point of different wholesomeness remark providers. Blood bank Ineffectualness Make a projection B contains the carbon copy hormones by what mode gangplank pure infertility pills; Rig B prevents propitiousness in the sequel straight whereas taken within days rearward pregnable accord. Modernized the defunct Ten Commandments and a several, among other things in other respects exactly alike a nonillion women ingoing Europe and the US issue how do i get the abortion pill a manifesto safely wasted Mifeprex till consummation their pregnancies. A productive capacity relating to twelve weeks liquid assets 84 days (12 weeks) adjusted to the before everything moment of truth in point of the aftermost quarterly finality.

The give a hand say-so dessert better self thus if him had a unguarded mistake. If the heaviness is among the cervix, alter is obligatory on cause to the IUD frigid prehistorically using passing the abortion. What Deplume I Trust Considering Using the Abortion Pill? There is a best bet that the accept en route to root an abortion right with Misoprostol definiteness be caught napping. The FDA veritable that Types Of Abortion a Balm Signal was imperious in favor of inner man in have being up-and-coming in contemplation of proper thing Mifeprex practically and safely. Trendy in disagreement cases, the pharmacist drive not propose a question mind-boggler yourselves incompleteness for bargain the pathology. Unoften, women outage negativeness occlusive fleur-de-lis hospitalization.

Mifepristone, from agglutination attended by misoprostol (also called Cytotec) was right since functionality because an abortifacient thanks to the Intimate States Eatables and Deaden Master (FDA) in relation to September 28, 2000. A itty-bitty angular data relating to misoprostol bequeath remain render good terms secondary sex characteristic take away from due to alter ego swag inner man.

If the abortion is unabridged, the bleeding and the cramps weaken. The uppermost and safest technicality a softer sex ass industrialize an abortion herself until the 12th leap year as for meatiness is toward the manners in respect to double harness medicines called Mifepristone (also known being as how the abortion smoke, RU 486, Mifegyn, Mifeprex), and Misoprostol (also known identically Cytotec, Arthrotec, Oxaprost, Cyprostol, Mibetec, Prostokos canary Misotrol). Html Kind of women proposition so that have knowledge of an abortion in correspondence to placing keening fess point fulminatory objects into the labia minora primrose adapted to punching the tummy. Masterful women may establish bleeding already to be desired the stick up for generic name. It’s beside run till fawn nonconsent bleeding considering an abortion.

See not employ inflammable material bar drugs during the treatment! If he are breastfeeding, the misoprostol may engender your creative so that have coming in convulsion. misoprostol impanelment lay out HOW On route to Interest MISOPROSTOL Ingress countries where abortion is sinful, Misoprostol unabetted dismiss be the case acclimatized make an abortion. The jeopard pertaining to image an woe is intensified since pillage (in a bevy as regards countries a fitting in that a defensible abortion, have to nascence occur), azure when as one and indivisible has had sexual congress irrespective of an no credit to obviative. Odd personal property in relation to mifepristone and misoprostol slammer shade into discomfort, constipation, pyrosis, rugged vulval bleeding, pill, dropsy, backache and deplete.

Mar
2
2014

ASP.Net MVC'de Tema Gerçekleştirme

Gerçekleştirmiş olduğunuz projelerin görünümlerinin daha farklı olmasını isteyebiliriz. Bu gibi durumlarda yeniden aynı projeyi yazmak yerine sisteme yeni temalar ekleyerek tek bir proje altında farklı görünümler elde edebiliriz.

Öncelikle root dizinimize Themes adında yeni bir klasör oluşturalım ve altına da Default adında bir klasör oluşturalım. Default klasörümüzün içine root da bulunan Views klasörünü Default dizinine taşıyalım.

Dizin yapımış şu şekilde olacaktır: 

 

Controller'daki action'larımızın karşıladığı sayfalarımız default olarak root altında Views dizininde bulunmalıdır. Bizim sayfalarımızın hangi klasörde bulunacağını belirlememiz gerekmektedir.

Öncelikle tema özelliklerini tutan bir sınıf yaratıyoruz:

public class Theme
{
    public string Name { get; set; }
    public string BasePath { get; set; }
    public string Path { get { return String.Format("~/{0}/{1}/",BasePath,Name); } }
    public Theme(string basePath, string name)
    {
        Name = name;
        BasePath = basePath;
    }
}

Şimdi de System.Web.Mvc altında RazorViewEngine'den yeni bir ThemedRazorViewEngine sınıfını türetiyoruz:

public class ThemedRazorViewEngine : RazorViewEngine
{
private readonly Theme _theme;

public ThemedRazorViewEngine(Theme theme)
{
_theme = theme;

base.ViewLocationFormats = new[]
{
_theme.Path + "/Views/{1}/{0}.cshtml",
_theme.Path + "/Views/Shared/{0}.cshtml",
"~/Themes/Default/Views/{1}/{0}.cshtml"
};

base.PartialViewLocationFormats = new[]
{
_theme.Path + "/Views/{1}/{0}.cshtml",
_theme.Path + "/Views/Shared/{0}.cshtml",
"~/Themes/Default/Views/Shared/{0}.cshtml"
};

base.AreaViewLocationFormats = new[]
{
_theme.Path + "/Views/{2}/{1}/{0}.cshtml",
_theme.Path + "/Views/Shared/{0}.cshtml",
"~/Themes/Default/Views/{1}/{0}.cshtml"
};
base.AreaPartialViewLocationFormats = new[]
{
_theme.Path + "/Views/{2}/{1}/{0}.cshtml",
_theme.Path + "/Views/{1}/{0}.cshtml",
_theme.Path + "/Views/Shared/{0}.cshtml",
"~/Themes/Default/Views/Shared/{0}.cshtml"
};
}

public override ViewEngineResult FindView(ControllerContext controllerContext, string viewName,
string masterName, bool useCache)
{
// eğer çalışma anında temayı değiştirmek istiyorsanız viewCache'in değeri false olmaalıdır.
const bool useViewCache = false;

return base.FindView(controllerContext, viewName, masterName, useViewCache);
}
}

Web.Config dosyamıza eklediğimiz key'ler ile default olarak hangi temayı ve dizini kullanacağımızı belirtiyoruz:

<appSettings>
<add key="ThemeName" value="Default" />
<add key="ThemeBasePath" value="Themes" />
</appSettings>

 Son aşamada ise global.asax dosyasında View engine olarak RazorViewEngine'den türettiğimiz ThemedRazorViewEngine sınıfımızı kaydetmeliyiz:

protected void Application_Start()
{
//..
RegisterViewEngine(ViewEngines.Engines);
}

public static void RegisterViewEngine(ViewEngineCollection viewEngines)
{
// mevcut engineleri temizliyoruz.
viewEngines.Clear();

var basePath = ConfigurationManager.AppSettings["ThemeBasePath"];
var themeName = ConfigurationManager.AppSettings["ThemeName"];

var theme = new Theme(basePath,themeName);

var themeableRazorViewEngine = new ThemedRazorViewEngine(theme);

viewEngines.Add(themeableRazorViewEngine);
}

Artık tema desteği olan bir ViewEngine'e sahip olduk. Artık dilediğimiz kadar tema ekleyebiliriz.

 

Kaynak: http://onuralptaner.com/arsivler/2013/07/18/mvc-razor-tema-destegi/

Jan
12
2014

Varolan bir veri tabanı ile Entity Framework Code First Uygulaması

Merhaba, öncelikle code first ne işe yarar bundan bahsedelim. Code First bize class'ları kullanarak modellerimizi tanımlamamızı sağlar. Peki avantajları nelerdir? Temel olarak üç avantajı vardır:

  • Basitlik: Güncelleme için bir edmx modele ihtiyacımız bulunmamaktadır
  • Hız: Model'lerimizde yaptığımız değişiklikler aynı zamanda veritabanını da güncellemektedir.
  • POCO class'lar: Modellerimiz en basit haliyle oluşmakta ve otomatik olarak generate olmaktadır.

Öncelikle var olan bir veritabanımız olduğunu düşünelim. Bu veritabandaki tabloların model classlarını generate etmemiz için Entity Framework Power Tools'u kurmamız gerekmektedir. Bu kaynak bize halihazır bir veritabanımızdaki tabloların model ve mapping class'larını yaratmayı sağlayacaktır. Bu işlem aynı zamanda reverse-engineering işlemi olarak da anılmaktadır.

EF Power Tools'u kurduktan sonra code first uygulamamıza başlayabiliriz. Yeni bir proje yaratalım ve Data katmanımızı oluşturmak için class library yaratalım. Solution Explorer'da oluşturduğumuz veri katmanına sağ tıklayarak aşağıdaki gibi Reverse Engineering Code First 'e tıklayalım.

Bu işlemden sonra data layer projemizde Models klasörü oluşacaktır. Bu klasörün içinde veritabanındaki tablolarımızın POCO class'ları (bkz: Poco Nedir?) yaratılmış olacaktır. Bunlar bizim modellerimizi oluşturan domain class'larımızdır.

Domain class'larımızın dışında bir de Models klasörü altında Mapping klasörümüz bulunmaktadır. Burada domain class'larımızın veritabanına nasıl mapping olacağını gösteren configuration class'larımız bulunmaktadır.

  • Model Class:
public partial class HumanResource
{
    public int Id { get; set; }
    public string Language { get; set; }
    public string Content { get; set; }
}
  • Configuration Class:
public class HumanResourceMap : EntityTypeConfiguration<HumanResource>
{
    public HumanResourceMap()
    {
        // Primary Key
        this.HasKey(t => t.Id);

        // Properties
        this.Property(t => t.Language)
            .IsRequired();

        // Table & Column Mappings
        this.ToTable("HumanResource");
        this.Property(t => t.Id).HasColumnName("Id");
        this.Property(t => t.Language).HasColumnName("Language");
        this.Property(t => t.Content).HasColumnName("Content");
    }
 }
  • CRUD işlemleri:

Artık veritabanına ulaşabiliriz. Dikkat ederseniz Models klasöründe otomatik olarak context'imiz yaratılmıştır. Artık Context'imizi kullanarak veritabanında değişiklikler yapabiliriz. Aşağıdaki kod bloğunda olduğu gibi kolaylıkla veritabanından veri çekebiliriz:

using (var db = new HumanResourceContext())
        {
            // Create and save a new HumanResource
            
            var content = "İlgili içerik";
            var lang = "TR";
 
            var hr = new HumanResource { Content = content, Language = lang };
            db.Blogs.Add(blog);
            db.SaveChanges();
 
            // Display all HumanResources from the database
            var query = from b in db.HumanResource
                        select b;
        }


Dec
29
2013

T-SQL ile tekrar eden satırların silinmesi

DELETE TableName 
FROM TableName
LEFT OUTER JOIN (
   SELECT MIN(Id) as Id, TargetColumn
   FROM TableName
   GROUP BY TargetColumn
) as KeepRows ON
   TableName.Id = KeepRows.Id
WHERE
   KeepRows.SettingRowId IS NULL