예제 #1
0
        public bool CopyProgram(CopyProgram CP, string InsertUser)
        {
            bool rpta = false;

            try
            {
                using (var SqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["DB_MDA_CR_OA_Connection"].ToString()))
                {
                    SqlCon.Open();
                    var SqlCmd = new SqlCommand("[music].[uspCopyProgram]", SqlCon)
                    {
                        CommandType = CommandType.StoredProcedure
                    };

                    //Insert Parameters
                    SqlParameter Source = new SqlParameter
                    {
                        ParameterName = "@ProgramIDSource",
                        SqlDbType     = SqlDbType.Int,
                        Value         = CP.ProgramIDSource
                    };
                    SqlCmd.Parameters.Add(Source);

                    SqlParameter ParInsertUser = new SqlParameter
                    {
                        ParameterName = "@InsertUser",
                        SqlDbType     = SqlDbType.VarChar,
                        Size          = 50,
                        Value         = InsertUser
                    };
                    SqlCmd.Parameters.Add(ParInsertUser);

                    SqlParameter ParProgramID = new SqlParameter
                    {
                        ParameterName = "@ProgramIDTarget",
                        SqlDbType     = SqlDbType.Int,
                        Value         = CP.ProgramIDTarget
                    };
                    SqlCmd.Parameters.Add(ParProgramID);

                    //Exec Command
                    SqlCmd.ExecuteNonQuery();

                    rpta = true;

                    if (SqlCon.State == ConnectionState.Open)
                    {
                        SqlCon.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(rpta);
        }
예제 #2
0
        public ActionResult CopyProgram(CopyProgram CP)
        {
            if (ModelState.IsValid)
            {
                string InsertUser = User.Identity.GetUserName();

                PBL.CopyProgram(CP, InsertUser);

                CP.ActionType = "CREATE";

                CP.ProgramList = PBL.AvailableProgramsForCopy(CP.ProgramIDTarget).ToList();

                return(View(CP));
            }
            return(View(CP));
        }
예제 #3
0
        public ActionResult CopyProgram(int id)
        {
            if (Request.IsAuthenticated)
            {
                var details = from p in PBL.WeeklyProgram()
                              where p.ProgramID == id
                              select p;

                Programs Program = details.FirstOrDefault();

                CultureInfo ci = new CultureInfo("Es-Es");

                string day = ci.DateTimeFormat.GetDayName(Program.ProgramDate.DayOfWeek).ToString();

                ViewBag.DayName = day.First().ToString().ToUpper() + day.Substring(1);

                ViewBag.PDate = Program.ProgramDate.ToString("dd/MM/yyyy");

                ViewBag.PSchedule = Program.ProgramSchedule;

                ViewBag.PID = id;

                var ProgramsList = from p in PBL.AvailableProgramsForCopy(id)
                                   select p;

                CopyProgram CP = new CopyProgram()
                {
                    ProgramIDTarget = id,
                    ProgramList     = ProgramsList.ToList()
                };

                return(View(CP));
            }
            else
            {
                return(this.RedirectToAction("Login", "Account"));
            }
        }
예제 #4
0
 public bool  CopyProgram(CopyProgram CP, string insertuser)
 {
     return(PDAL.CopyProgram(CP, insertuser));
 }