Exemplo n.º 1
0
 public String AddModifyBlogDetails(ClsBlogDetails ObjBlog)
 {
     using (ClsMasterManagement_DAL obj = new ClsMasterManagement_DAL())
     {
         return(obj.AddModifyBlogDetails(ObjBlog));
     }
 }
Exemplo n.º 2
0
        public string AddModifyBlogDetails(ClsBlogDetails ObjBlogDetails)
        {
            try
            {
                DBParameterCollection ObJParameterCOl = new DBParameterCollection();
                DBParameter           objDBParameter  = new DBParameter("@Ref_Blog_ID", ObjBlogDetails.Ref_Blog_ID, DbType.Int64);
                ObJParameterCOl.Add(objDBParameter);
                objDBParameter = new DBParameter("@BlogTitle", ObjBlogDetails.BlogTitle, DbType.String);
                ObJParameterCOl.Add(objDBParameter);
                objDBParameter = new DBParameter("@Blog", ObjBlogDetails.Blog, DbType.String);
                ObJParameterCOl.Add(objDBParameter);
                objDBParameter = new DBParameter("@IsActive", ObjBlogDetails.IsActive, DbType.Boolean);
                ObJParameterCOl.Add(objDBParameter);
                objDBParameter = new DBParameter("@CreatedBy", ObjBlogDetails.CreatedBy, DbType.String);
                ObJParameterCOl.Add(objDBParameter);

                DBHelper objDbHelper = new DBHelper();
                Int64    Ref_Blog_ID = Convert.ToInt64(objDbHelper.ExecuteScalar(Constant.AddModifyBlogDetails, ObJParameterCOl, CommandType.StoredProcedure));

                if (Ref_Blog_ID > 0)
                {
                    ObjBlogDetails.FileManager.ForEach(File =>
                    {
                        DBParameterCollection ObJParameterCOl1 = new DBParameterCollection();
                        DBParameter objDBParameter1            = new DBParameter("@FileManagerID", File.FileManagerID, DbType.Int64);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@ModuleID", Ref_Blog_ID, DbType.Int64);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@ModuleType", File.ModuleType, DbType.String);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@FileIdentifier", File.FileIdentifier, DbType.String);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@FileName", File.FileName, DbType.String);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@FilePath", File.FilePath, DbType.String);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@FileExtension", File.FileExtension, DbType.String);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@FileType", File.FileType, DbType.String);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@FileSize", File.FileSize, DbType.Int64);
                        ObJParameterCOl1.Add(objDBParameter1);
                        objDBParameter1 = new DBParameter("@FileSequence", File.Sequence, DbType.Int32);
                        ObJParameterCOl1.Add(objDBParameter1);

                        objDbHelper.ExecuteScalar(Constant.SaveModuleFile, ObJParameterCOl1, CommandType.StoredProcedure).ToString();
                    });
                }

                if (Ref_Blog_ID > 0 && ObjBlogDetails.Ref_Blog_ID == 0)
                {
                    return("BLOGADDED");
                }
                else if (Ref_Blog_ID > 0 && ObjBlogDetails.Ref_Blog_ID > 0)
                {
                    return("BLOGUPDATED");
                }
                else
                {
                    return("BLOGEXISTS");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }