Exemple #1
0
        private List <SqlParameter> Set_Values_In_Testimonial(TestimonialInfo testimonial)
        {
            List <SqlParameter> sqlParams = new List <SqlParameter>();

            if (testimonial.Testimonial_Id != 0)
            {
                sqlParams.Add(new SqlParameter("@Testimonial_Id", testimonial.Testimonial_Id));
            }

            sqlParams.Add(new SqlParameter("@Title", testimonial.Title));
            sqlParams.Add(new SqlParameter("@Content", testimonial.Content));
            sqlParams.Add(new SqlParameter("@Author_Image", testimonial.Author_Image));
            sqlParams.Add(new SqlParameter("@Author_Name", testimonial.Author_Name));
            sqlParams.Add(new SqlParameter("@Author_Designation", testimonial.Author_Designation));
            sqlParams.Add(new SqlParameter("@Is_Active", testimonial.Is_Active));

            if (testimonial.Testimonial_Id == 0)
            {
                sqlParams.Add(new SqlParameter("@Created_By", testimonial.Created_By));
                sqlParams.Add(new SqlParameter("@Created_On", testimonial.Created_On));
            }

            sqlParams.Add(new SqlParameter("@Updated_By", testimonial.Updated_By));
            sqlParams.Add(new SqlParameter("@Updated_On", testimonial.Updated_On));

            return(sqlParams);
        }
Exemple #2
0
        private TestimonialInfo Get_Testimonial_Values_By_Id(DataRow dr)
        {
            TestimonialInfo testimonial = new TestimonialInfo();

            testimonial.Testimonial_Id     = Convert.ToInt32(dr["Testimonial_Id"]);
            testimonial.Title              = Convert.ToString(dr["Title"]);
            testimonial.Content            = Convert.ToString(dr["Content"]);
            testimonial.Author_Image       = Convert.ToInt32(dr["Author_Image"]);
            testimonial.Author_Name        = Convert.ToString(dr["Author_Name"]);
            testimonial.Author_Designation = Convert.ToString(dr["Author_Designation"]);
            testimonial.Is_Active          = Convert.ToBoolean(dr["Is_Active"]);
            testimonial.Created_By         = Convert.ToInt32(dr["Created_By"]);
            testimonial.Updated_By         = Convert.ToInt32(dr["Updated_By"]);
            testimonial.Created_On         = Convert.ToDateTime(dr["Created_On"]);
            testimonial.Updated_On         = Convert.ToDateTime(dr["Updated_On"]);

            if (dr["File_Type"] != DBNull.Value)
            {
                testimonial.File_Type = Convert.ToInt32(dr["File_Type"]);
            }
            if (dr["Unique_Id"] != DBNull.Value)
            {
                testimonial.Author_Image_Url = Convert.ToString(dr["Unique_Id"]);
            }

            return(testimonial);
        }
 private void Edit(int OperationID)
 {
     try
     {
         TestimonialController ctl = new TestimonialController();
         TestimonialInfo       obj = ctl.GetRecordByID(OperationID, GetPortalID, int.Parse(SageUserModuleID));
         txtName.Text             = obj.UserName;
         txtAddress.Text          = obj.Address;
         txtDate.Text             = CommonHelper.ShortTimeReturn(obj.TestimonialDate);
         txtWeburl.Text           = obj.WebUrl;
         txtTestimonial.Value     = obj.Testimonial;
         Session["Image"]         = obj.Image;
         Session["TestimonialID"] = obj.TestimonialID;
         if (obj.Image != "")
         {
             divImage.Visible       = true;
             imgProfilepic.ImageUrl = basePath + "image/UploadedImages/" + obj.Image;
         }
         else
         {
             divImage.Visible = false;
         }
         ShowHidePage();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #4
0
 public List <TestimonialInfo> GetTestData(int PortalID, int UserModuleID, bool IsSlider)
 {
     try
     {
         List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();
         ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", PortalID));
         ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserModuleID", UserModuleID));
         ParaMeterCollection.Add(new KeyValuePair <string, object>("@IsSlider", IsSlider));
         SQLHandler    SQLH = new SQLHandler();
         SqlDataReader reader;
         reader = SQLH.ExecuteAsDataReader("[dbo].[usp_TestimonialGetData]", ParaMeterCollection);
         List <TestimonialInfo> Userinfo = new List <TestimonialInfo>();
         while (reader.Read())
         {
             TestimonialInfo obj = new TestimonialInfo();
             obj.TestimonialID = Convert.ToInt32(reader["TestimonialID"].ToString());
             obj.UserName      = reader["UserName"].ToString();
             obj.Address       = reader["Address"].ToString();
             obj.WebUrl        = reader["WebUrl"].ToString();
             obj.Title         = reader["Title"].ToString();
             obj.Image         = reader["Image"].ToString();
             obj.Testimonial   = reader["Testimonial"].ToString();
             obj.AddedBy       = reader["AddedBy"].ToString();
             obj.AddedOn       = reader["AddedOn"].ToString();
             Userinfo.Add(obj);
         }
         return(Userinfo);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Exemple #5
0
 public List <TestimonialInfo> LoadRecordsOnGrid(int PortalID, int UserModuleID)
 {
     try
     {
         string TestmonialDesc = string.Empty;
         List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> >();
         ParaMeterCollection.Add(new KeyValuePair <string, object>("@PortalID", PortalID));
         ParaMeterCollection.Add(new KeyValuePair <string, object>("@UserModuleID", UserModuleID));
         SQLHandler    SQLH = new SQLHandler();
         SqlDataReader reader;
         reader = SQLH.ExecuteAsDataReader("[dbo].[usp_TestimonialGetRecord]", ParaMeterCollection);
         List <TestimonialInfo> Userinfo = new List <TestimonialInfo>();
         while (reader.Read())
         {
             TestimonialInfo obj = new TestimonialInfo();
             obj.TestimonialID = Convert.ToInt32(reader["TestimonialID"]);
             obj.UserName      = reader["UserName"].ToString();
             obj.Address       = reader["Address"].ToString();
             obj.WebUrl        = reader["WebUrl"].ToString();
             obj.Image         = reader["Image"].ToString();
             obj.Testimonial   = HTMLHelper.StripTagsRegex(reader["Testimonial"].ToString());
             obj.AddedBy       = reader["AddedBy"].ToString();
             obj.AddedOn       = reader["AddedOn"].ToString();
             Userinfo.Add(obj);
         }
         return(Userinfo);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Exemple #6
0
        public static void SaveRecord(TestimonialInfo objInfo)
        {
            try
            {
                SqlConnection SqlConn = new SqlConnection(SystemSetting.SageFrameConnectionString);
                SqlCommand    SqlCmd  = new SqlCommand();

                SqlCmd.Connection  = SqlConn;
                SqlCmd.CommandText = "usp_TestimonialAddRecord";
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.Add(new SqlParameter("@TestimonialID", objInfo.TestimonialID));
                SqlCmd.Parameters.Add(new SqlParameter("@PortalID", objInfo.PortalID));
                SqlCmd.Parameters.Add(new SqlParameter("@UserModuleID", objInfo.UserModuleID));
                SqlCmd.Parameters.Add(new SqlParameter("@UserName", objInfo.UserName));
                SqlCmd.Parameters.Add(new SqlParameter("@Address", objInfo.Address));
                SqlCmd.Parameters.Add(new SqlParameter("@WebUrl", objInfo.WebUrl));
                SqlCmd.Parameters.Add(new SqlParameter("@Image", objInfo.Image));
                SqlCmd.Parameters.Add(new SqlParameter("@Title", objInfo.Title));
                SqlCmd.Parameters.Add(new SqlParameter("@TestimonialDate", objInfo.TestimonialDate));
                SqlCmd.Parameters.Add(new SqlParameter("@Testimonial", objInfo.Testimonial));
                SqlCmd.Parameters.Add(new SqlParameter("@AddedBy", objInfo.AddedBy));

                SqlConn.Open();
                SqlCmd.ExecuteNonQuery();
                SqlConn.Close();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemple #7
0
        public TestimonialViewModel()
        {
            FriendlyMessage = new List <FriendlyMessage>();

            Pager = new PaginationInfo();

            testimonial = new TestimonialInfo();

            testimonials = new List <TestimonialInfo>();
        }
Exemple #8
0
 public void SaveRecord(TestimonialInfo obj)
 {
     try
     {
         TestimonialDataProvider.SaveRecord(obj);
     }
     catch
     {
         throw;
     }
 }
 private void Delete(int OperationID)
 {
     try
     {
         TestimonialController ctl = new TestimonialController();
         TestimonialInfo       obj = ctl.GetImage(OperationID, GetPortalID, int.Parse(SageUserModuleID));
         DeleteImage(obj.Image);
         ctl.DeleteRecordByID(OperationID);
         ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Testimonial/ModuleLocalText", "RecordDeletedSuccessfully"), "", SageMessageType.Success);
         LoadRecordsOnGrid();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #10
0
        private TestimonialInfo Get_Testimonial_Values(DataRow dr)
        {
            TestimonialInfo testimonial = new TestimonialInfo();

            testimonial.Testimonial_Id     = Convert.ToInt32(dr["Testimonial_Id"]);
            testimonial.Title              = Convert.ToString(dr["Title"]);
            testimonial.Content            = Convert.ToString(dr["Content"]);
            testimonial.Author_Image       = Convert.ToInt32(dr["Author_Image"]);
            testimonial.Author_Name        = Convert.ToString(dr["Author_Name"]);
            testimonial.Author_Designation = Convert.ToString(dr["Author_Designation"]);
            testimonial.Is_Active          = Convert.ToBoolean(dr["Is_Active"]);
            testimonial.Created_By         = Convert.ToInt32(dr["Created_By"]);
            testimonial.Updated_By         = Convert.ToInt32(dr["Updated_By"]);
            testimonial.Created_On         = Convert.ToDateTime(dr["Created_On"]);
            testimonial.Updated_On         = Convert.ToDateTime(dr["Updated_On"]);

            return(testimonial);
        }
Exemple #11
0
        public TestimonialInfo Get_Testimonial_By_Id(int Testimonial_Id)
        {
            TestimonialInfo testimonial = new TestimonialInfo();

            List <SqlParameter> sqlParams = new List <SqlParameter>();

            sqlParams.Add(new SqlParameter("@Testimonial_Id", Testimonial_Id));

            DataTable      dt     = _sqlRepo.ExecuteDataTable(sqlParams, StoredProcedures.Get_Testimonial_By_Id_Sp.ToString(), CommandType.StoredProcedure);
            List <DataRow> drList = new List <DataRow>();

            drList = dt.AsEnumerable().ToList();
            foreach (DataRow dr in drList)
            {
                testimonial = Get_Testimonial_Values_By_Id(dr);
            }
            return(testimonial);
        }
Exemple #12
0
 public void Update_Testimonial(TestimonialInfo testimonial)
 {
     _sqlRepo.ExecuteNonQuery(Set_Values_In_Testimonial(testimonial), StoredProcedures.Update_Testimonial_Sp.ToString(), CommandType.StoredProcedure);
 }
    private void AddUpdateRecord()
    {
        string imagefile          = string.Empty;
        TestimonialController clt = new TestimonialController();
        TestimonialInfo       obj = new TestimonialInfo();

        if (Session["TestimonialID"] != null && Session["TestimonialID"].ToString() != string.Empty)
        {
            obj.TestimonialID = Int32.Parse(Session["TestimonialID"].ToString());
        }
        else
        {
            obj.TestimonialID = 0;
        }

        obj.PortalID        = GetPortalID;
        obj.UserModuleID    = int.Parse(SageUserModuleID);
        obj.UserName        = txtName.Text;
        obj.Address         = txtAddress.Text;
        obj.WebUrl          = txtWeburl.Text;
        obj.Title           = txtTitle.Text;
        obj.Testimonial     = txtTestimonial.Value;
        obj.AddedBy         = GetUsername;
        obj.TestimonialDate = DateTime.Parse(txtDate.Text);
        string TargetFolder = Server.MapPath(basePath + "image/UploadedImages");

        if (!Directory.Exists(TargetFolder))
        {
            Directory.CreateDirectory(TargetFolder);
        }

        imagefile = ProfileImage.FileName.Replace(" ", "_");

        if (Session["Image"] == null && imagefile == "")
        {
            obj.Image = "";
        }
        else if (imagefile == "" && Session["Image"] != null)
        {
            obj.Image = Session["Image"].ToString();
        }
        else
        {
            if (ProfileImage.HasFile)
            {
                System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
                obj.Image = imagefile;
                using (System.Drawing.Bitmap originalImage = new System.Drawing.Bitmap(ProfileImage.PostedFile.InputStream))
                {
                    using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(250, 150, thumbnailImageAbortDelegate, IntPtr.Zero))
                    {
                        thumbnail.Save(System.IO.Path.Combine(TargetFolder, imagefile));
                    }
                }
            }
        }
        clt.SaveRecord(obj);
        ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Testimonial/ModuleLocalText", "SaveRecordSuccessfully"), "", SageMessageType.Success);
        LoadRecordsOnGrid();
        divGrid.Visible = true;
        ClearField();
    }
Exemple #14
0
 public int Insert_Testimonial(TestimonialInfo testimonial)
 {
     return(_testimonialRepo.Insert_Testimonial(testimonial));
 }
Exemple #15
0
 public void Update_Testimonial(TestimonialInfo testimonial)
 {
     _testimonialRepo.Update_Testimonial(testimonial);
 }
    private void AddUpdateRecord()
    {
        string imagefile=string.Empty;
        TestimonialController clt = new TestimonialController();
        TestimonialInfo obj = new TestimonialInfo();

        if (Session["TestimonialID"] != null && Session["TestimonialID"].ToString() != string.Empty)
        {
            obj.TestimonialID  = Int32.Parse(Session["TestimonialID"].ToString());   
        }
        else
        {
           obj.TestimonialID = 0;
        }

        obj.PortalID = GetPortalID;
        obj.UserModuleID = int.Parse(SageUserModuleID);
        obj.UserName = txtName.Text;      
        obj.Address = txtAddress.Text;
        obj.WebUrl = txtWeburl.Text;
        obj.Title = txtTitle.Text;
        obj.Testimonial = txtTestimonial.Value;
        obj.AddedBy = GetUsername;
        obj.TestimonialDate = DateTime.Parse(txtDate.Text);
        string TargetFolder = Server.MapPath(basePath + "image/UploadedImages");
        if (!Directory.Exists(TargetFolder))
        {
            Directory.CreateDirectory(TargetFolder);
        }
      
        imagefile = ProfileImage.FileName.Replace(" ", "_");

        if (Session["Image"] == null && imagefile == "")
        {
            obj.Image = "";
        }
        else if (imagefile == "" && Session["Image"] != null)
        {
            obj.Image = Session["Image"].ToString();
        }
        else
        {
            if (ProfileImage.HasFile)
            {
                System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
                obj.Image = imagefile;
                using (System.Drawing.Bitmap originalImage = new System.Drawing.Bitmap(ProfileImage.PostedFile.InputStream))
                {
                    using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(250, 150, thumbnailImageAbortDelegate, IntPtr.Zero))
                    {
                        thumbnail.Save(System.IO.Path.Combine(TargetFolder, imagefile));
                    }
                }
            }
        }
        clt.SaveRecord(obj);
        ShowMessage(SageMessageTitle.Information.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/Testimonial/ModuleLocalText", "SaveRecordSuccessfully"), "", SageMessageType.Success);
        LoadRecordsOnGrid();
        divGrid.Visible = true;   
        ClearField();
    }
Exemple #17
0
 public int Insert_Testimonial(TestimonialInfo testimonial)
 {
     return(Convert.ToInt32(_sqlRepo.ExecuteScalerObj(Set_Values_In_Testimonial(testimonial), StoredProcedures.Insert_Testimonial_Sp.ToString(), CommandType.StoredProcedure)));
 }