Exemple #1
0
        public int SaveDocumentDA(DocumentBE objDocumentBE, int userID, int webinarID)
        {
            int rtnDocID = 0;
            try
            {
                using (MySqlConnection sqlCon = new MySqlConnection(Constant.EBirdConnectionString))
                {
                    MySqlCommand sqlCmd = new MySqlCommand("spUpdateDocumentRef", sqlCon);
                    sqlCon.Open();
                    sqlCmd.CommandType = CommandType.StoredProcedure;
                    sqlCmd.Parameters.Add(new MySqlParameter("pClientID", objDocumentBE.ClientID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pCategory", objDocumentBE.Category));
                    sqlCmd.Parameters.Add(new MySqlParameter("pOrgFileName", objDocumentBE.OrginalFileName));
                    sqlCmd.Parameters.Add(new MySqlParameter("pSavedFileName", objDocumentBE.SavedFileName));
                    sqlCmd.Parameters.Add(new MySqlParameter("pInsertedBy", objDocumentBE.InsertedBy));
                    sqlCmd.Parameters.Add(new MySqlParameter("pDocID", objDocumentBE.DocumentID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pUserID", userID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pWebinarID", webinarID));

                    MySqlDataReader reader = sqlCmd.ExecuteReader();
                    if (reader.HasRows)
                    {
                        reader.Read();
                        rtnDocID = Convert.ToInt32(reader[0]);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return rtnDocID;
        }
Exemple #2
0
 public int saveFiles(UploadedFile fs, string folderType, int clientID, int actionBy, int userID, int webinarID)
 {
     int DocID = 0;
     string fname = "";
     try
     {
         DocumentBE objDcoumentBE = new DocumentBE();
         DocumentDA objDocumentDA = new DocumentDA();
         if (fs.FileName != "")
         {
             fname = System.IO.Path.GetFileName(fs.FileName);
             switch (folderType.ToUpper())
             {
                 case "PROFILE":
                     fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Profile\\" + fname);
                     break;
                 case "LOGO":
                     fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Logo\\" + fname);
                     break;
                 case "BANNER":
                     fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Logo\\" + fname);
                     break;
                 case "PRESENTATION":
                     fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\WebinarDocs\\" + fname);
                     break;
                 case "SS":
                     fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\SS\\" + fname);
                     break;
                 case "TEMP":
                     fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Temp\\" + fname);
                     break;
             }
             objDcoumentBE.DocumentID = 0;
             objDcoumentBE.ClientID = clientID;
             objDcoumentBE.Category = folderType;
             objDcoumentBE.OrginalFileName = fname; //fs.GetName();
             objDcoumentBE.SavedFileName = fname; //fs.GetName();
             objDcoumentBE.InsertedBy = actionBy;
             objDcoumentBE.PresenterID = userID;
             objDcoumentBE.WebinarID = webinarID;
             DocID = objDocumentDA.SaveDocumentDA(objDcoumentBE, userID, webinarID);
         }
     }
     catch (Exception ex)
     {
         objUtil.RecordLogToFS("DocAccess-saveFiles:" + ex.Message);
     }
     return DocID;
 }
Exemple #3
0
        public int SaveDocumentDA(DocumentBE objDocumentBE)
        {
            int docID = objDocumentBE.DocumentID;
            string sql1 = "";

            if (docID == 0)
                sql1 = DBQuery.sqlDocumentInsert;
            else
                sql1 = DBQuery.sqlDocumentUpdate;
            try
            {
                using (MySqlConnection sqlCon = new MySqlConnection(Constant.EBirdConnectionString))
                {

                    MySqlCommand sqlCmd = new MySqlCommand("spUpdateDocumentRef", sqlCon);
                    sqlCon.Open();
                    sqlCmd.CommandType = CommandType.StoredProcedure;
                    sqlCmd.Parameters.Add(new MySqlParameter("pClientID", objDocumentBE.ClientID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pCategory", objDocumentBE.Category));
                    sqlCmd.Parameters.Add(new MySqlParameter("pOrgFileName", objDocumentBE.OrginalFileName));
                    sqlCmd.Parameters.Add(new MySqlParameter("pSavedFileName", objDocumentBE.SavedFileName));
                    sqlCmd.Parameters.Add(new MySqlParameter("pInsertedBy", objDocumentBE.InsertedBy));
                    sqlCmd.Parameters.Add(new MySqlParameter("pDocID", objDocumentBE.DocumentID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pUserID", objDocumentBE.PresenterID));
                    sqlCmd.Parameters.Add(new MySqlParameter("pWebinarID", objDocumentBE.WebinarID));

                    MySqlDataReader reader = sqlCmd.ExecuteReader();
                    if (reader.HasRows)
                    {
                        reader.Read();
                        docID = Convert.ToInt32(reader.GetValue(0));
                    }
                    reader.Close();
                    reader = null;
                    sqlCon.Close();
                    //}
                    return docID;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #4
0
        public int saveFiles(UploadedFile fs, string folderType, int clientID, int actionBy)
        {
            int DocID = 0;
            string fname = "";
            try
            {
                DocumentBE objDcoumentBE = new DocumentBE();
                DocumentDA objDocumentDA = new DocumentDA();
                if (fs.FileName != "")
                {
                    fname = System.IO.Path.GetFileName(fs.FileName);
                    switch (folderType.ToUpper())
                    {
                        case "PROFILE":
                            fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Profile\\" + fname);
                            break;
                        case "LOGO":
                            fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Logo\\" + fname);
                            break;
                        case "BANNER":
                            fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\Logo\\" + fname);
                            break;
                        case "PRESENTATION":
                            fs.SaveAs(Constant.DocRepoClient + clientID.ToString() + "\\WebinarDocs\\" + fname);
                            break;
                    }
                    objDcoumentBE.DocumentID = 0;
                    objDcoumentBE.ClientID = clientID;
                    objDcoumentBE.Category = folderType;
                    objDcoumentBE.OrginalFileName = fname; //fs.GetName();
                    objDcoumentBE.SavedFileName = fname; //fs.GetName();
                    objDcoumentBE.InsertedBy = actionBy;

                    DocID = objDocumentDA.SaveDocumentDA(objDcoumentBE);
                }
            }
            catch (Exception ex)
            {

            }
            return DocID;
        }