Ejemplo n.º 1
0
        public int RegisterPinCode(PincodeRegistration pinCode)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
            var pincodeId        = -1;

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                var sql = "insert into pinmast (station, loc, inc, pwd, pinc, area, stype) values(@station, @loc, @incharge, @pwd, @pincode, @area, @stationType) select SCOPE_IDENTITY()";

                SqlCommand cmd = new SqlCommand(sql, con);
                cmd.Parameters.AddWithValue("@station", pinCode.StationName);
                cmd.Parameters.AddWithValue("@loc", pinCode.Location);
                cmd.Parameters.AddWithValue("@incharge", pinCode.Incharge);
                cmd.Parameters.AddWithValue("@pwd", pinCode.Password);
                cmd.Parameters.AddWithValue("@pincode", pinCode.Pincode);
                cmd.Parameters.AddWithValue("@area", pinCode.Area);
                cmd.Parameters.AddWithValue("@stationType", pinCode.StationType);
                con.Open();

                pincodeId = Convert.ToInt32(cmd.ExecuteScalar());

                con.Close();
            }

            return(pincodeId);
        }
Ejemplo n.º 2
0
        public ActionResult RegisterPincode(PincodeViewModel pincodeModel)
        {
            var admin   = new ASTIAdmin();
            var pinCode = new PincodeRegistration();

            pinCode.Area        = pincodeModel.Area;
            pinCode.Incharge    = pincodeModel.Incharge;
            pinCode.Location    = pincodeModel.Location;
            pinCode.Password    = pincodeModel.Password;
            pinCode.Pincode     = pincodeModel.Pincode;
            pinCode.StationName = pincodeModel.StationName;
            pinCode.StationType = pincodeModel.StationType;

            var pinCodeId = admin.RegisterPinCode(pinCode);

            ViewBag.IsPincodeRegistered = true;
            return(View());
        }
Ejemplo n.º 3
0
        public int RegisterPinCode(PincodeRegistration pinCode)
        {
            var admin = new ASTIAdminDAL();

            return(admin.RegisterPinCode(pinCode));
        }