Ejemplo n.º 1
0
        private List <SqlParameter> Set_Values_In_Attachment(AttachmentsInfo attachment)
        {
            List <SqlParameter> sqlParams = new List <SqlParameter>();

            sqlParams.Add(new SqlParameter("@Ref_Id", attachment.Ref_Id));
            sqlParams.Add(new SqlParameter("@Ref_Type", attachment.Ref_Type));
            sqlParams.Add(new SqlParameter("@Document_Name", attachment.Document_Name));
            sqlParams.Add(new SqlParameter("@CreatedBy", attachment.CreatedBy));
            sqlParams.Add(new SqlParameter("@CreatedOn", attachment.CreatedOn));
            sqlParams.Add(new SqlParameter("@UpdatedBy", attachment.UpdatedBy));
            sqlParams.Add(new SqlParameter("@UpdatedOn", attachment.UpdatedOn));
            sqlParams.Add(new SqlParameter("@Remark", attachment.Remark));    //

            return(sqlParams);
        }
Ejemplo n.º 2
0
        private AttachmentsInfo Get_Attachments_Values(DataRow dr)
        {
            AttachmentsInfo attachments = new AttachmentsInfo();

            attachments.Attachment_Id = Convert.ToInt64(dr["Attachment_Id"]);
            attachments.Ref_Id        = Convert.ToInt32(dr["Ref_Id"]);
            attachments.Ref_Type      = Convert.ToInt32(dr["Ref_Type"]);
            attachments.Document_Name = Convert.ToString(dr["Document_Name"]);
            attachments.CreatedBy     = Convert.ToInt32(dr["CreatedBy"]);
            attachments.CreatedOn     = Convert.ToDateTime(dr["CreatedOn"]);
            attachments.UpdatedBy     = Convert.ToInt32(dr["UpdatedBy"]);
            attachments.UpdatedOn     = Convert.ToDateTime(dr["UpdatedOn"]);
            //attachments.Remark = Convert.ToString(dr["Remark"]);
            return(attachments);
        }
Ejemplo n.º 3
0
        public JsonResult View_Attachment_By_Id(int Attachment_Id)
        {
            AttachmentsInfo attachment = new AttachmentsInfo();

            try
            {
                attachment           = _attachmentsMan.Get_Attachment_By_Id(Attachment_Id);
                attachment.Unique_Id = ConfigurationManager.AppSettings["Upload_Image_Path"].ToString() + @"\" + attachment.File_Type_Str + @"\" + attachment.Unique_Id;
            }
            catch (Exception ex)
            {
                Logger.Error("Error : " + ex.ToString());
            }

            return(Json(attachment, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        private AttachmentsInfo Get_Attachments_Values(DataRow dr)
        {
            AttachmentsInfo attachments = new AttachmentsInfo();

            attachments.Attachment_Id = Convert.ToInt32(dr["Attachment_Id"]);
            attachments.File_Name     = Convert.ToString(dr["File_Name"]);
            attachments.Unique_Id     = Convert.ToString(dr["Unique_Id"]);
            attachments.File_Type     = Convert.ToInt32(dr["File_Type"]);
            attachments.Is_Active     = Convert.ToBoolean(dr["Is_Active"]);
            attachments.Created_By    = Convert.ToInt32(dr["Created_By"]);
            attachments.Updated_By    = Convert.ToInt32(dr["Updated_By"]);
            attachments.Created_On    = Convert.ToDateTime(dr["Created_On"]);
            attachments.Updated_On    = Convert.ToDateTime(dr["Updated_On"]);

            return(attachments);
        }
Ejemplo n.º 5
0
        private List <SqlParameter> Set_Values_In_Attachments(AttachmentsInfo attachment)
        {
            List <SqlParameter> sqlParams = new List <SqlParameter>();

            //sqlParams.Add(new SqlParameter("@Attachment_Id", attachments.Attachment_Id));
            sqlParams.Add(new SqlParameter("@File_Name", attachment.File_Name));
            sqlParams.Add(new SqlParameter("@Unique_Id", attachment.Unique_Id));
            sqlParams.Add(new SqlParameter("@File_Type", attachment.File_Type));
            sqlParams.Add(new SqlParameter("@Is_Active", attachment.Is_Active));
            sqlParams.Add(new SqlParameter("@Created_By", attachment.Created_By));
            sqlParams.Add(new SqlParameter("@Updated_By", attachment.Updated_By));
            sqlParams.Add(new SqlParameter("@Created_On", attachment.Created_On));
            sqlParams.Add(new SqlParameter("@Updated_On", attachment.Updated_On));

            return(sqlParams);
        }
Ejemplo n.º 6
0
        public CustomerQualityViewModel()
        {
            Friendly_Message = new List <FriendlyMessageInfo>();

            Pager = new PaginationInfo();

            Customer_Quality = new CustomerQualityInfo();

            Customer_Qualities = new List <CustomerQualityInfo>();

            Filter = new CustomerQualityFilter();

            Attachment = new AttachmentsInfo();

            Attachments = new List <AttachmentsInfo>();
        }
Ejemplo n.º 7
0
        public AttachmentsInfo Get_Attachment_By_Id(int Attachment_Id)
        {
            AttachmentsInfo attachment = new AttachmentsInfo();

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

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

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

            drList = dt.AsEnumerable().ToList();
            foreach (DataRow dr in drList)
            {
                attachment = Get_Attachments_Values(dr);
            }
            return(attachment);
        }
Ejemplo n.º 8
0
        public List <AttachmentsInfo> Get_Attachment_By_Type(ref PaginationInfo pager, int File_Type)
        {
            List <AttachmentsInfo> attachments = new List <AttachmentsInfo>();

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

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

            DataTable dt = _sqlRepo.ExecuteDataTable(sqlParams, StoredProcedures.Get_Attachments_By_File_Type_Sp.ToString(), CommandType.StoredProcedure);

            foreach (DataRow dr in CommonMethods.GetRows(dt, ref pager))
            {
                AttachmentsInfo attachment = new AttachmentsInfo();

                attachment           = Get_Attachments_Values(dr);
                attachment.Unique_Id = ConfigurationManager.AppSettings["Upload_Image_Path"].ToString() + @"\" + attachment.File_Type_Str + @"\" + attachment.Unique_Id;

                //attachments.Add(Get_Attachments_Values(dr));
                attachments.Add(attachment);
            }
            return(attachments);
        }
Ejemplo n.º 9
0
        public JsonResult Delete_Attachment(long attachment_Id)
        {
            List <FriendlyMessageInfo> Friendly_Message = new List <FriendlyMessageInfo>();

            AttachmentsInfo attachments = new AttachmentsInfo();

            try
            {
                AjaxManager aMan = new AjaxManager();

                attachments = aMan.Get_Attachment_By_Id(attachment_Id);

                var saveToFileLoc = string.Format("{0}\\{1}",
                                                  Server.MapPath("/uploads/" + attachments.Ref_Type_Str + "/" + attachments.Ref_Id),
                                                  attachments.Document_Name);

                if (saveToFileLoc != null || saveToFileLoc != string.Empty)
                {
                    if ((System.IO.File.Exists(saveToFileLoc)))
                    {
                        System.IO.File.Delete(saveToFileLoc);
                    }
                }

                aMan.Delete_Attachment_By_Id(attachment_Id);

                Friendly_Message.Add(MessageStore.Get("AJ002"));
            }
            catch (Exception ex)
            {
                Friendly_Message.Add(MessageStore.Get("SYS01"));

                Logger.Error("Ajax Controller - Delete_Attachment " + ex.ToString());
            }

            return(Json(new { Friendly_Message }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
 public void Insert_Attachment(AttachmentsInfo attachment)
 {
     _attachmentsRepo.Insert_Attachment(attachment);
 }
Ejemplo n.º 11
0
 public long Insert_Attachment(AttachmentsInfo attachment)
 {
     return(_ajaxRepo.Insert_Attachment(attachment));
 }
Ejemplo n.º 12
0
        public long Insert_Attachment(AttachmentsInfo attachment)
        {
            long attachemnt_Id = Convert.ToInt64(sqlRepo.ExecuteScalerObj(Set_Values_In_Attachment(attachment), StoredProcedures.Insert_Attachment_Sp.ToString(), CommandType.StoredProcedure));

            return(attachemnt_Id);
        }
Ejemplo n.º 13
0
 public void Insert_Attachment(AttachmentsInfo attachment)
 {
     _sqlRepo.ExecuteNonQuery(Set_Values_In_Attachments(attachment), StoredProcedures.Insert_Attachments_Sp.ToString(), CommandType.StoredProcedure);
 }