private void ContentUpGeneric(DataTable dt, int Rows, string strExcelFileName) { clsDAL objDAL; AirtelModel objAirtelModel = new AirtelModel(); objAirtelModel.ExcelFileName = strExcelFileName; objAirtelModel.ContentDate = Convert.ToDateTime(dt.Rows[Rows]["Date"].ToString()).ToString("MM/dd/yyyy"); objAirtelModel.ContentText = dt.Rows[Rows]["F2"].ToString().Replace("'", null); objAirtelModel.ContentMonth = ContentMonth(objAirtelModel.ContentDate); objAirtelModel.SheetName = TableNameFormat(dt.TableName.ToString()); objDAL = new clsDAL(); string sqlQuery = "EXEC spContentUpload '" + objAirtelModel.ExcelFileName + "','" + objAirtelModel.ContentDate + "',N'" + objAirtelModel.ContentText + "','" + objAirtelModel.ContentMonth + "','" + objAirtelModel.SheetName + "'"; objDAL.ExecuteQuery(sqlQuery, KeyConstant.Server_Sahbox_17); }
private void ContentUpAirtelHorosCope(DataTable dt, int Rows, string strExcelFileName) { clsDAL objDAL; AirtelModel objAirtelModel = new AirtelModel(); objAirtelModel.ExcelFileName = strExcelFileName; objAirtelModel.ContentDate = Convert.ToDateTime(dt.Rows[Rows]["Date"].ToString()).ToString("MM/dd/yyyy"); objAirtelModel.HorosCopeCode = dt.Rows[Rows]["Do Not Touch These Columns (B,C,D,E,F)"].ToString().Replace("'", null); objAirtelModel.HorosCopeName = dt.Rows[Rows]["F3"].ToString().Replace("'", null); objAirtelModel.ContentText = dt.Rows[Rows]["F4"].ToString().Replace("'", null); objAirtelModel.ContentMonth = ContentMonth(objAirtelModel.ContentDate); objAirtelModel.SheetName = TableNameFormat(dt.TableName.ToString()); objDAL = new clsDAL(); string sqlQuery = "EXEC spContentUploadAirtelHoroscope '" + objAirtelModel.ExcelFileName + "','" + objAirtelModel.ContentDate + "','" + objAirtelModel.HorosCopeCode + "','" + objAirtelModel.HorosCopeName + "',N'" + objAirtelModel.ContentText + "','" + objAirtelModel.ContentMonth + "','" + objAirtelModel.SheetName + "'"; objDAL.ExecuteQuery(sqlQuery, KeyConstant.Server_Sahbox_17); }
private void InsertAirtel(string dbServer, string dbName, string dbTable, int SheetID, string ContentMonth, string ContentYear) { string sqlQuerySelect, sqlQueryInsert, sqlQueryUpdate = String.Empty; int StatusInsert = 0; sqlQuerySelect = "SELECT Content_Date,Content_Text,Text_Len FROM tbl_Upload WHERE db_info=" + SheetID + " AND ContentMonth='" + ContentMonth + "' AND Year(Content_Date)='" + ContentYear + "' AND Status=0"; IDataReader dr = objDAL.GetDataReader(sqlQuerySelect, KeyConstant.Server_Sahbox_17); while (dr.Read()) { AirtelModel objAirtelModel = new AirtelModel(); objAirtelModel.ContentDate = Convert.ToString(dr["Content_Date"], null); objAirtelModel.TextLen = Convert.ToInt32(dr["Text_Len"], null); objAirtelModel.ContentText = Convert.ToString(dr["Content_Text"], null); if (SheetID == 20) { sqlQueryInsert = " INSERT INTO " + dbTable + " VALUES('" + objAirtelModel.ContentDate + "','" + objAirtelModel.ContentText + "')"; } else { sqlQueryInsert = " INSERT INTO " + dbTable + " (date,sms_eng) VALUES('" + objAirtelModel.ContentDate + "','" + objAirtelModel.ContentText + "')"; } sqlQueryUpdate = " UPDATE tbl_Upload SET Status=1 WHERE db_info=" + SheetID + " AND Content_Date='" + objAirtelModel.ContentDate + "' "; if (dbName == "WARID_CONTENT") { objDAL.ExecuteQuery(sqlQueryInsert, KeyConstant.Server_31_WaridContent); StatusInsert = 1; } else if (dbName == "WARID") { objDAL.ExecuteQuery(sqlQueryInsert, KeyConstant.Server_31_Warid); StatusInsert = 1; } if (StatusInsert == 1) { objDAL.ExecuteQuery(sqlQueryUpdate, KeyConstant.Server_Sahbox_17); } //clsDAL.db.CreateConnection().Close(); } }