コード例 #1
0
        public DataTable GetEntityWiseData(object EntityName, object SyncDate)
        {
            DataTable dtEntity = new DataTable();

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.SqlSyncConn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "[USP_R_GETSYNCDATA]";
                    cmd.Parameters.AddWithValue("@EntityName", EntityName);
                    cmd.Parameters.AddWithValue("@SyncDate", SyncDate);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        da.Fill(dtEntity);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error While Retreiving Entity wise data List", ex);
            }
            finally
            {
                SQLCon.SqlSyncConn().Close();
            }
            return(dtEntity);
        }
コード例 #2
0
        public void SaveData(string entityName, DataTable dtEntityWiseData)
        {
            if (dtEntityWiseData?.Rows.Count == 0 || !entityMapping.ContainsKey(entityName))
            {
                return;
            }

            try
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = SQLCon.SqlSyncConn();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = entityMapping[entityName].ProcedureName;
                    cmd.Parameters.AddWithValue(entityMapping[entityName].ParameterName, dtEntityWiseData);
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"Error While saving Entity {entityName} wise data List", ex);
            }
            finally
            {
                SQLCon.SqlSyncConn().Close();
            }
        }
コード例 #3
0
 public void ClearOldData()
 {
     try
     {
         using (SqlCommand cmd = new SqlCommand())
         {
             cmd.Connection  = SQLCon.SqlSyncConn();
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.CommandText = "POS_USP_D_OLD_DATA";
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw new Exception($"Error While clearing old data", ex);
     }
     finally
     {
         SQLCon.SqlSyncConn().Close();
     }
 }