Example #1
0
        public static string[] GetEditActor(string id)
        {
            ActorBAL  sActorBAL = new ActorBAL();
            DataTable sDt       = new DataTable();

            string[] strActorData = new string[9];

            try
            {
                sActorBAL.ActorId = Convert.ToInt32(id);
                sDt = sActorBAL.ActorSelect();

                if (sDt.Rows.Count > 0)
                {
                    strActorData[0] = sDt.Rows[0]["FirstName"].ToString();
                    strActorData[1] = sDt.Rows[0]["LastName"].ToString();
                    strActorData[2] = sDt.Rows[0]["Email"].ToString();
                    strActorData[3] = Convert.ToDateTime(sDt.Rows[0]["BirthDate"].ToString()).Date.ToShortDateString();
                    strActorData[4] = sDt.Rows[0]["Age"].ToString();
                    strActorData[5] = sDt.Rows[0]["Bio"].ToString();
                    strActorData[6] = sDt.Rows[0]["ActorDocument"].ToString();
                    strActorData[7] = sDt.Rows[0]["Other"].ToString();
                    strActorData[8] = id;
                }

                return(strActorData);
            }
            catch (Exception ex)
            {
                strActorData[0] = ex.Message;
                return(strActorData);
            }
        }
Example #2
0
        public void ActorActiveInActive(ActorBAL actorBAL)
        {
            try
            {
                con = Connection.GetConnection();
                cmd = Connection.GetCommand("ActorActiveInActive", con);
                con.Open();
                cmd.Parameters.AddWithValue("@ActorId", actorBAL.ActorId);
                cmd.Parameters.AddWithValue("@IsActive", actorBAL.IsActive);

                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                if (con.State != ConnectionState.Closed)
                    con.Close();
            }
        }
Example #3
0
        public void CreateActorListForFillingDropDownList()
        {
            string   actorListJson = "";
            ActorBAL actorBAL      = new ActorBAL();

            DataTable dt = actorBAL.ActorSelectForDropDown();

            foreach (DataRow dr in dt.Rows)
            {
                actorListJson += "'" + dr["ActorName"].ToString() + "," + dr["ActorId"].ToString() + "':" + "'" + dr["ActorName"].ToString() + "," + dr["ActorId"].ToString() + "',";
            }
            actorListJson = actorListJson.TrimEnd(',');

            string addActorJsFunction = "<script type=\"text/javascript\" language=\"javascript\"> " +

                                        " function getActorList() " +
                                        " { " +
                                        //" return { '1': 'Samrat - Arya', '2': 'Vedant - Sharma', '3': 'Eklavya - Varma' }; " +
                                        " return { " + actorListJson + " }; " +
                                        " } " +

                                        " </script>";

            Response.Write(addActorJsFunction);
        }
Example #4
0
        public void ActorActiveInActive(ActorBAL actorBAL)
        {
            try
            {
                con = Connection.GetConnection();
                cmd = Connection.GetCommand("ActorActiveInActive", con);
                con.Open();
                cmd.Parameters.AddWithValue("@ActorId", actorBAL.ActorId);
                cmd.Parameters.AddWithValue("@IsActive", actorBAL.IsActive);

                cmd.ExecuteNonQuery();
                con.Close();
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }
Example #5
0
 public DataTable ActorSelect(ActorBAL actorBAL)
 {
     try
     {
         dt  = new DataTable();
         con = Connection.GetConnection();
         cmd = Connection.GetCommand("ActorSelect", con);
         cmd.Parameters.AddWithValue("@ActorId", actorBAL.ActorId);
         sda = new SqlDataAdapter(cmd);
         sda.Fill(dt);
         return(dt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
        public static string CheckUnCheck(string actorId, string value)
        {
            ActorBAL actorBAL = new ActorBAL();

            actorBAL.ActorId  = Convert.ToInt32(actorId);
            actorBAL.IsActive = Convert.ToBoolean(value);

            try
            {
                actorBAL.ActorActiveInActive();
                return("0");
            }
            catch (SqlException ex)
            {
                return(ex.Message);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #7
0
        public int ActorInsert(ActorBAL actorBAL)
        {
            try
            {
                con = Connection.GetConnection();
                cmd = Connection.GetCommand("ActorInsert", con);
                con.Open();

                cmd.Parameters.AddWithValue("@FirstName", actorBAL.FirstName);
                cmd.Parameters.AddWithValue("@LastName", actorBAL.LastName);
                cmd.Parameters.AddWithValue("@Email", actorBAL.Email);
                cmd.Parameters.AddWithValue("@BirthDate", actorBAL.BirthDate);
                cmd.Parameters.AddWithValue("@Bio", actorBAL.Bio);
                cmd.Parameters.AddWithValue("@ActorDocument", actorBAL.ActorDocument);
                cmd.Parameters.AddWithValue("@Other", actorBAL.Other);
                cmd.Parameters.AddWithValue("@ProjectId", actorBAL.ProjectId);
                cmd.Parameters.AddWithValue("@IsActive", actorBAL.IsActive);

                cmd.Parameters.AddWithValue("@ActorId", actorBAL.ActorId);
                cmd.Parameters["@ActorId"].Direction = ParameterDirection.InputOutput;

                cmd.ExecuteNonQuery();
                con.Close();

                int actorId = Convert.ToInt32(cmd.Parameters["@ActorId"].Value);
                return(actorId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                {
                    con.Close();
                }
            }
        }
Example #8
0
        public int ActorInsert(ActorBAL actorBAL)
        {
            try
            {
                con = Connection.GetConnection();
                cmd = Connection.GetCommand("ActorInsert", con);
                con.Open();

                cmd.Parameters.AddWithValue("@FirstName", actorBAL.FirstName);
                cmd.Parameters.AddWithValue("@LastName", actorBAL.LastName);
                cmd.Parameters.AddWithValue("@Email", actorBAL.Email);
                cmd.Parameters.AddWithValue("@BirthDate", actorBAL.BirthDate);
                cmd.Parameters.AddWithValue("@Bio", actorBAL.Bio);
                cmd.Parameters.AddWithValue("@ActorDocument", actorBAL.ActorDocument);
                cmd.Parameters.AddWithValue("@Other", actorBAL.Other);
                cmd.Parameters.AddWithValue("@ProjectId", actorBAL.ProjectId);
                cmd.Parameters.AddWithValue("@IsActive", actorBAL.IsActive);

                cmd.Parameters.AddWithValue("@ActorId", actorBAL.ActorId);
                cmd.Parameters["@ActorId"].Direction = ParameterDirection.InputOutput;

                cmd.ExecuteNonQuery();
                con.Close();

                int actorId = Convert.ToInt32(cmd.Parameters["@ActorId"].Value);
                return actorId;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (con.State != ConnectionState.Closed)
                    con.Close();
            }
        }
Example #9
0
 public DataTable ActorSelect(ActorBAL actorBAL)
 {
     try
     {
         dt = new DataTable();
         con = Connection.GetConnection();
         cmd = Connection.GetCommand("ActorSelect", con);
         cmd.Parameters.AddWithValue("@ActorId", actorBAL.ActorId);
         sda = new SqlDataAdapter(cmd);
         sda.Fill(dt);
         return dt;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }